首页 > 试题广场 >

一个数据表student(No,Name,Sex,Age,D

[单选题]
一个数据表student(No, Name, Sex, Age, Dept),以下不能完成对应操作的sql语句是?
  • 查询所有14岁到18岁之间的男学生,并输出他们的姓名和年龄:<br>Select Name, Age From<br>student Where sex = ‘male’ and age between 14 and 18
  • 查询所有姓名包含“妍”的学生:<br>Select * From student<br>Where name like “_妍%”
  • 统计表中学生涉及的院系个数:<br>Select<br>count(*)From (Select distinct Dept From student)
  • 统计表中不同系别的男生的平均年龄,并按从大到小排列:<br>Select Dept, avg(Age)<br>From student Where sex = ‘male’ Group by Dept Order by avg(Age)
-- 正确的应该是:
<br>Select * From student<br>Where name like “%妍%”
-- 姓名中只要包含“妍”就ok,位置无所谓。原选项中的_代表单字符,如果利用该子句进行查询,筛选结果就会漏掉姓为“妍”的学生。

发表于 2022-02-04 15:42:06 回复(0)