欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

sql條件查詢語句的簡單實(shí)例

 更新時(shí)間:2013年10月17日 15:32:06   作者:  
這篇文章介紹了sql條件查詢語句的簡單實(shí)例,有需要的朋友可以參考一下
復(fù)制代碼 代碼如下:

//創(chuàng)建成績表
create table result(
       stu_id varchar2(20) not null,
       china number(9,2) null,
       math number(9,2) null,
       english number(9,2) null
);

//插入數(shù)據(jù)
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 '優(yōu)秀'
         when china>=60 then '及格'
         when china<60 then  '不及格'
         end) as 語文 ,
      (case
         when math>80 then '優(yōu)秀'
         when math>=60 then '及格'
         when math<60 then '不及格'
       end )as 數(shù)學(xué) ,
         (case
         when english>80 then '優(yōu)秀'
         when english>=60 then '及格'
         when english<60 then '不及格'
       end) as 英語
from result               

相關(guān)文章

最新評論