S_T数据库关系图如下:[img=332x128]17e448fc85e997f.jpg[/img]查询与“刘晨”在同一个系学习的学生,要求显示学生学号(Sno)、姓名(Sname)及系别(Sdept)。下列SQL语句正确的是()。
A: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept = (SELECT Sdept FROM Student WHERE Sname = '刘晨');
B: SELECT S1.Sno, S1.Sname , S1.Sdept FROM Student S1 , Student S2 WHERE S1.Sdept = S2.Sdept AND S2.Sname = '刘晨';
C: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept IN (SELECT Sdept FROM Student WHERE Sname = '刘晨');
D: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept LIKE (SELECT Sdept FROM Student WHERE Sname = '刘晨');
A: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept = (SELECT Sdept FROM Student WHERE Sname = '刘晨');
B: SELECT S1.Sno, S1.Sname , S1.Sdept FROM Student S1 , Student S2 WHERE S1.Sdept = S2.Sdept AND S2.Sname = '刘晨';
C: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept IN (SELECT Sdept FROM Student WHERE Sname = '刘晨');
D: SELECT Sno, Sname, Sdept FROM Student WHERE Sdept LIKE (SELECT Sdept FROM Student WHERE Sname = '刘晨');
举一反三
- 在所有学生中查询比计算机系学生平均年龄大的学生姓名,可以使用的查询语句是: A: SELECT Sname FROM Student WHERE Sage > ( SELECT AVG(Sage) FROM Student ); WHERE Sdept = 'CS' B: SELECT Sname FROM Student WHERE Sage > AVG( SELECT Sage FROM Student WHERE Sdept = 'CS' ); C: SELECT Sname FROM Student WHERE Sage > ( SELECT AVG(Sage) FROM Student WHERE Sdept = 'CS' ); D: SELECT Sname FROM Student WHERE AVG(Sage) > ( SELECT Sage FROM Student WHERE Sdept = 'CS' );
- 在所有学生中查询比计算机系所有学生年龄都要大的学生姓名,正确的查询语句是___________________。 A: SELECT Sname FROM Student WHERE Sage > ( SELECT MAX(Sage) FROM Student WHERE Sdept = 'CS'); B: SELECT Sname FROM Student WHERE Sage > ALL ( SELECT Sage FROM Student WHERE Sdept = 'CS'); C: SELECT Sname FROM Student S1 WHERE EXISTS ( SELECT Sage FROM Student S2 WHERE Sdept = 'CS' AND S1.Sage > S2.Sage); D: SELECT Sname FROM Student S1 WHERE NOT EXISTS ( SELECT * FROM Student S2 WHERE Sdept = 'CS' AND S1.Sage <= S2.Sage);
- 【单选题】针对学生表student(sno,sname,ssex,sage,sdept),其中sno为学号,sname为姓名,ssex为性别,sage为年龄,sdept为系别。查询学生的姓名sname,系别sdept和年龄sage,显示时按系别升序排列,系别相同的再按年龄降序排列。() A. select * from student order by sdept , sage B. select sname, sdept, sage from student order by sdept , sage desc C. select sname, sdept, sage from student order by sdept desc , sage D. select * from student order by sdept desc, sage
- 在student(sno,sname,ssex,sage,sdept)表中,查询学生姓名中包含“大”或“小”的学生信息。以下查询语句正确的是( )。 A: select * from student where sname in( '_[大小]%') B: select * from student where sname ='%大%' or sname='%小%' C: select * from student where sname like'%大%' or sname like'%小%' D: select * from student where sname like '%[大小]%'
- 关于查询命令SELECT sname FROM student WHERE sdept IN(SELECT sdept FROM student WHERE sname = '刘晨'),说法正确的是()。 A: 功能是查询和刘晨所在同一系的学生姓名 B: IN可以换成= C: IN不一定可以换成= D: 该查询可以用连接实现