原始表
现在有一张student表,包含三个字段:s_id,c_id,s_score:

目的1:如果只保留得到s_id为01,s_score为80的结果
输入语句:
select * from score where case when s_id =01 and s_score =80 then 0 else 1 end=
0;
结果:

目的2:筛选除同时满足s_id为01,s_score为80以外的所有数据
输入语句:
select * from score where case when s_id =01 and s_score =80 then 0 else 1 end=
1;
输出结果:

博客围绕student表展开,该表有s_id、c_id、s_score三个字段。给出两个数据筛选目的及对应SQL语句,一是保留s_id为01且s_score为80的结果,二是筛选除同时满足这两个条件外的所有数据。
538

被折叠的 条评论
为什么被折叠?



