SQL面试题收录

时间:2023-02-28 18:14:38

1、用一条SQL语句
查询出每门课都大于80分的学生姓名

SQL面试题收录

SELECT DISTINCT
  NAME
FROM
  t_score_tab
WHERE NAME NOT IN
  (SELECT DISTINCT
    NAME
  FROM
    t_score_tab
  WHERE score <= 80)

SQL面试题收录

2、查询两门或两门以上成绩都超过80分(含80)的学生姓名

SQL面试题收录

SELECT
  NAME
FROM
  t_score_tab
WHERE score >= 80
GROUP BY NAME
HAVING COUNT(1) >= 2 

SQL面试题收录