用SQL语句查询每门成绩都大于80的学生姓名? 新手求教。。

表名stu 结构如下

name km fs
张三 语文 81
张三 数学 75
李四 语文 76
王五 英语 90
李四 数学 90
王五 语文 81
王五 数学 99

select name from stu group by name having min(fs)>=80。

还有这些简单语句。

简单基本的sql语句

更新:update table1 set field1=value1 where 范围

查找:select * from table1 where field1 like ’%value1%’ (所有包含‘value1’这个模式的字符串)

排序:select * from table1 order by field1,field2 [desc]

求和:select sum(field1) as sumvalue from table1

平均:select avg(field1) as avgvalue from table1

最大:select max(field1) as maxvalue from table1

最小:select min(field1) as minvalue from table1[separator]

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-02-27
select name from stu group by name having min(fs)>=80本回答被提问者和网友采纳
第2个回答  2011-11-30
select name
from stu t1
where not exists(select 1 from tab where name = t1.name and fs < 80)
第3个回答  2011-11-30
select distinct a.name
from (select name, km, fs, count(*) over(partition by name) as num
from stu) a,
(select name, count(*) num from stu where fs > 80 group by name) b
where a.num = b.num
and a.name = b.name;
第4个回答  2011-11-30
select distinct name from stu where name not in(select name from stu where fs<80)

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网