若要求查找“年龄大于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’
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’
举一反三
- 若要求查找‘李’姓学生的学生号和姓名,正确的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 ’%李%’
- 查询选修了课程号为“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=‘刘-’ C: SELECT S#,SNAME,FROM S WHERE SNAME LIKE‘刘%’ D: SELECT S#,SNAME,FROM S WHERE SNAME LIKE ‘刘-’
- 假定有学生关系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
- 假设数据库中有“学生(S)-选课(SC)-课程(C)”的三个关系:S(S#,SNAME,SEX,AGE) SC(S#,C#,GRADE) C(C#,CNAME,TEACHER) 若要求查找姓“王”的学生的学号和姓名。下面列出的 SQL 语句中正确的是______。Ⅰ.SELECT S#,SNAME FROM S WHERE SNAME=’王%’ Ⅱ.SELECT S#,SNAME FROM S WHERE SNAME LIKE ’王%’Ⅲ.SELECT S#,SNAME FROM S WHERE SNAME LIKE ’王_%’ A: Ⅰ B: Ⅱ C: Ⅲ D: 全部