Oracel,将表中的数据,大于60为及格,小于60为不及格的转化。
create table Score(name varchar2(10),yuwen number(10),shuxue number(10),yingyu number(10));
insert into Score (NAME, YUWEN, SHUXUE, YINGYU)
values ('小明', 10, 70, 100);
insert into Score (NAME, YUWEN, SHUXUE, YINGYU)
values ('小白', 80, 40, 10);
select t.name,
(case when t.yuwen>60 then '及格' else '不及格' end) as 语文,
(case when t.shuxue>60 then '及格' else '不及格' end) as 数学,
(case when t.yingyu>60 then '及格' else '不及格' end) as 英语
from Score t;
Case When的用法,简单小例子
最新推荐文章于 2024-05-21 21:16:41 发布