查询各门课程超过80分的学生姓名
2012-05-09 16:46
399 查看
表结构及内容
SQL语句:
CREATE TABLE IF NOT EXISTS `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(10) NOT NULL, `subject` varchar(10) NOT NULL, `score` int(11) NOT NULL, PRIMARY KEY (`id`) ) INSERT INTO `student` (`id`, `name`, `subject`, `score`) VALUES (1, '小明', '英文', 80), (2, '小明', '数学', 79), (3, '小明', '语文', 81), (4, '小刚', '英文', 80), (5, '小刚', '数学', 80), (6, '小刚', '语文', 80), (7, '小红', '英文', 90), (8, '小红', '数学', 90), (9, '小红', '语文', 81);
SQL语句:
#方法一 select name from student group by name having in(score)>80 #方法二 select distinct name from student where name not in ( select name from student where score<80 ) #方法三 select name from student where score>80 group by name having COUNT(*)>1
相关文章推荐
- 用一条SQL语句 查询出每门课程都大于80分的学生姓名" 的实现方式
- 查询每门课程成绩都大于80分学生的姓名
- 面试题:用一条sql语句查询出“每门”课程都大于80分的学生姓名
- 查询每门课程成绩都大于80分学生的姓名
- 面试题:用一条sql语句查询出“每门”课程都大于80分的学生姓名
- 用一条sql语句查询出“每门”课程都大于80分的学生姓名
- SQL查询选修了全部课程的学生姓名解析
- 查询选修了全部课程的学生姓名
- sql语句:查询每门课大于80分的学生姓名
- 用一条SQL语句 查询出每门课都大于80分的学生姓名
- 查询选修了全部课程的学生姓名
- SQL-EXIST-查询选修了全部课程的学生姓名
- 用一条SQL语句 查询出每门课都大于80分的学生姓名
- 用一条SQL语句 查询出每门课都大于80分的学生姓名
- 一个SQL查询出每门课程的成绩都大于80的学生姓名
- 1. 查询全部学生的学号、姓名、课程名称、成绩。
- SQL用一条SQL语句 查询出每门课都大于80分的学生姓名
- 一个SQL查询出每门课程的成绩都大于80的学生姓名
- 如何理解 多个 exists sql(查询选修了全部课程的学生姓名)
- SQL查询选修了所有课程的学生姓名