• 2022-06-07
    下列选项中,用于将 student 表按照 gender 字段进行分组查询,并且查询 score 字段值之和小于300的分组的 SQL 语句是
    A: SELECT gender , SUM ( score ) FROM student GROUP BY gender HAVING SUM ( score )<;300;
    B: SELECT gender , SUM ( score ) FROM student GROUP BY gender WHERE SUM ( score )300;
    C: SELECT gender , SUM ( score ) FROM student WHERE SUM ( score )<;300 GROUP BY gender ;
    D: 以上语句都不对
  • A

    举一反三

    内容

    • 0

      将student表按照gender字段进行分组查询,查询出grade字段值之和小于300的分组,依据上述要求,下面选项中,正确的SQL语句是

    • 1

      从student表中查询学生姓名、年龄和成绩,结果按照年龄降序排序,年龄相同的按照成绩升序排序,下面SQL语句正确的是: A: select name, age, score from student order by age desc , score; B: select name, age, score from student order by age , score asc; C: select name, age, score from student order by 2 desc , 3 asc; D: select name, age, score from student order by 1 desc , 2;

    • 2

      下面用if语句统计“成绩(score)优秀的男生以及不及格的男生”的人数,正确的语句为_____。 A: if(gender=="男" and score &lt;60 or score&gt;=90): n+ = 1 B: if(gender=="男" and score &lt;60 and score&gt;=90): n+ = 1 C: if(gender=="男" and (score &lt;60 or score&gt;=90)): n+ = 1 D: if(gender=="男" or score &lt;60 or score&gt;=90): n+ = 1

    • 3

      要从SC表中查找缺成绩(SCORE)的学生学号(NO),相应的SQL语句是( )。 A: SELECT NO FROM SC WHERE SCORE = 0 B: SELECT NO FROM SC WHERE SCORE IS 'NULL' C: SELECT NO FROM SC WHERE SCORE = NULL D: SELECT NO FROM SC WHERE SCORE IS NULL

    • 4

      下列的查询语句哪一项是错误的(选一项) A: Select * from stumarks where score>=60 B: Select * from (select * from stumarks where score>=60) C: Select * from (select * from stumarks where score>=60) as temp D: Select * from (select * from stumarks ) as temp where score>=60