题目内容

现有学生关系表S(sno,sname,ssex,sage),查找年龄在18岁到20岁之间的女生学号和姓名的SQL语句是________。

A. selectsno,snamefromSwheressex='女'andsagenotbetween20and18;
B. select*fromSwheressex<>'男'andsage>=18andsage<=20;
C. selectsno,snamefromSwheressex='女'and18<=sage<=20;
D. selectsno,snamefromSwheressex='女'andsagebetween18and20;

查看答案
更多问题

现有学生关系表S(sno,sname,ssex,sage),查找年龄为空值的女生信息的SQL语句是________。

A. select*fromSwheressex='女'andsage=Null;
B. select*fromSwheressexis'女'andsageisNull;
C. select*fromSwheressex='女'andsageisNull;
D. select*fromSwheressexis'女'andsage=Null;

现有学生关系表S(sno,sname,ssex,sage),查找所有姓"陈"的男生姓名信息的SQL语句是________。

A. selectsnamefromSwheressex='男'andsnamelike'陈';
B. selectsnamefromSwheressex='男'andsnamelike'陈_';
C. selectsnamefromSwheressex='男'andsname='陈%';
D. selectsnamefromSwheressex='男'andsnamelike'陈%';

现有学生关系表S(sno,sname,ssex,sage),查找所有男生和女生的平均年龄信息,对应的SQL语句是________。

A. select ssex, avg(sage) fromS where ssex in('男', '女');
B. select ssex, avg(sage) fromS group by ssex;
C. select ssex, avg(sage) fromS;
D. select ssex, avg(distinct sage) fromS group by ssex;

在学生关系表S(sno,sname,ssex,sage)上查找各年龄段的学生人数,显示总人数在10人以上的年龄段并按人数多少降序排列,对应的SQL语句是________。

A. select sage, count(*) from S where count(*)>10 group by sage order by count(*) DESC;
B. selectsage,count(*)人数fromSwheresum(*)>10orderby人数DESC;
C. selectsage,count(*)人数fromSgroupbysagehavingsum(*)>10orderby人数DESC;
D. selectsage,count(*)人数fromSgroupbysagehavingcount(*)>10orderby人数DESC;

答案查题题库