sql条件照会文の簡単な例



//
create table result(
       stu_id varchar2(20) not null,
       china number(9,2) null,
       math number(9,2) null,
       english number(9,2) null
);

//
insert into result values('0001',60,20,80);
insert into result values('0002',80,60,80);
insert into result values('0003',20,85,80);
select *from result;

//
select  stu_id,(case
         when china>80 then ' '
         when china>=60 then ' '
         when china<60 then  ' '
         end) as ,
      (case
         when math>80 then ' '
         when math>=60 then ' '
         when math<60 then ' '
       end )as ,
         (case
         when english>80 then ' '
         when english>=60 then ' '
         when english<60 then ' '
       end) as
from result