语句 SELECT * FROM StInfo WHERE ClName = (SELECT ClName FROM StInfo WHERE StName='金萍') 是查询和金萍同班的同学的信息
举一反三
- 查询所有目前年龄不到18岁的学生的姓名、所在班级及年龄,正确的命令是( )。 A: SELECT StName, ClName,YEAR(GETDATE())-YEAR(birthdate) age FROM StInfo WHERE age<18 B: SELECT StName,ClName, YEAR(GETDATE())-YEAR(birthdate) FROM StInfo WHERE YEAR(birthdate)<18 C: SELECT StName, ClName, YEAR(GETDATE())-YEAR(birthdate) ageFROM StInfo WHERE YEAR(GETDATE())-YEAR(birthdate)<18 D: SELECT StName,ClName, YEAR(date())-YEAR(birthdate) FROM StInfo WHERE age<18
- 假定学生表为StInfo(Stid,Stname,Stsex,ClName),其中Stid为学号,Stname为姓名,Stsex为性别,ClName为班级名称。以下SQL语句是用于查询至少有两名男生的班级。但语句不完整,应该选择填入语句最后。 SELECT ClName AS 班级名称 FROM StInfo WHERE Stsex ='男'
- 修改视图vsex以查询stinfo表中女学生信息的正确语句是( )。 A: ALTER VIEW vsex AS SELECT * FROM stinfo WHERE 姓名 ='女' B: MODIFY TABLE vsex AS SELECT * FROM stinfo WHERE 性别= '女' C: ALTER VIEW vsex AS SELECT * FROM stinfo WHERE 性别 ='女' D: ALTER TABLE vsex AS SELECT * FROM stinfo WHERE 性别= '女'
- 语句: SELECT StId,StName INTO new_info FROM StInfo 的功能是
- 表stinfo和表scinfo,语句 SELECT stname, cno ,score FROM stinfo s LEFT JOIN scinfo sc ON s.stid=sc.stid 与语句 SELECT stname, cno,score FROM scinfo sc LEFT JOIN stinfo s ON s.stid=sc.stid 查询结果集完全相同