假定有学生关系S,结构为S(SID, SNAME, AGE),其中SID为学号,SNAME为姓名,AGE为年龄。查询所有比“李军”年龄大的学生的姓名、年龄,正确的SQL语句是( )。
A: SELECT SNAME, AGE FROM S WHERE AGE > ( SELECT AGE FROM S WHERE SNAME = '李军' )
B: SELECT SNAME, AGE FROM S WHERE AGE >( SNAME= '李军' )
C: SELECT SNAME, AGE FROM S WHERE AGE > ( SELECT AGE WHERE SNAME='李军' )
D: SELECT SNAME, AGE FROM S WHERE AGE>李军.AGE
A: SELECT SNAME, AGE FROM S WHERE AGE > ( SELECT AGE FROM S WHERE SNAME = '李军' )
B: SELECT SNAME, AGE FROM S WHERE AGE >( SNAME= '李军' )
C: SELECT SNAME, AGE FROM S WHERE AGE > ( SELECT AGE WHERE SNAME='李军' )
D: SELECT SNAME, AGE FROM S WHERE AGE>李军.AGE
举一反三
- 若要求查找“年龄大于18岁学生的学生号和姓名”,正确的SQL语句是( )。 A: SELECT S#,SNAME FROM S WHERE AGE>18 B: SELECT S#,SNAME FROM S WHERE AGE>=18 C: SELECT S#,SNAME FROM S WHERE AGE>’18’ D: SELECT S#,SNAME FROM S WHERE AGE>=’18’
- 假定有学生关系S,结构为S(SID, SNAME, AGE),其中SID为学号,SNAME为姓名,AGE为年龄。查询所有比“李军”年龄大的学生的姓名、年龄,正确的SQL语句是
- 对于学生信息表:student(sno,sname,sex,age,dept),能够得到年龄在20岁至22岁之间的学生的姓名和学号的语句是( )。 A: SELECT*FROM student WHERE age BETWEEN 20 AND 22 B: SELECT sname,sno FROM student WHERE age BETWEEN 20 AND 22 C: SELECT sname,sno FROM student WHERE age>=20 D: SELECT sname,sno FROM student WHERE age<=22
- 查询选修了课程号为“C1”的学生的姓名和年龄,若用下列SQL的SELECT语句表达时,错误的是( )。 A: SELECT SNAME,AGE FROM S WHERE B: S#=(SELECT S C: S#FROM SC WHERE D: C#='C1') E: SELECT SNAME,AGE FROM S,SC WHERE F: S#=S G: S# AND S H: C#='C1' I: SELECT SNAME,AGE FROM S,SC WHERE J: S#=S K: S# AND S L: C#='C1' ORDERBY M: S# N: SELECT SNAME,AGE FROM S WHERE O: S#=(SELECT S P: S# FROM SC WHERE S Q: C#='C1')
- 若要求查找‘李’姓学生的学生号和姓名,正确的SQL语句是( )。 A: SELECT S#,SNAME FROM S WHERE SNAME=’李%’ B: SELECT S#,SNAME FROM S WHERE SNAME LIKE ’李%’ C: SELECT S#,SNAME FROM S WHERE SNAME=’%李%’ D: SELECT S#,SNAME FROM S WHERE SNAME LIKE ’%李%’