“题目1:当关系R和S进行连接操作时,如果R中的元组不满足连接条件,在连接结果中也会将这些记录保留下来的操作是( )。
: 左外连接
; 右外连接
; 内连接
; 自连接”
“题目2:聚合函数中,不忽略空值的是( )。
: SUM(列名)
; MAX(列名)
; AVG(列名)
; COUNT(*)”
“题目3:查询语句中,错误的是( )。
: SELECT Sno, COUNT(*) FROM SC GROUP BY Sno
; SELECT Sno FROM SC GROUP BY Sno WHERE COUNT(*) > 3
; SELECT Sno FROM SC GROUP BY Sno HAVING COUNT(*) > 3
; SELECT Sno FROM SC GROUP BY Sno”
“题目4:现要利用Student表查询年龄最小的学生姓名和年龄。下列实现此功能的查询语句中,正确的是( )。
: SELECT Sname, MIN(Sage) FROM Student
; SELECT Sname, Sage FROM Student WHERE Sage = MIN(Sage)
; SELECT TOP 1 Sname, Sage FROM Student
; SELECT TOP 1 Sname, Sage FROM Student ORDER BY Sage”
“题目5:设SC表中记录成绩的列为:Grade,类型为int。若在查询成绩时,希望将成绩按‘优’、‘良’、‘中’、‘及格’和‘不及格’形式显示,正确的Case表达式是( )。
: Case Grade
When 90~100 THEN ‘优’
When 80~89 THEN ‘良’
When 70~79 THEN ‘中’
When 60~69 THEN ‘及格’
Else ‘不及格’
End
; Case
When Grade between 90 and 100 THEN Grade = ‘优’
When Grade between 80 and 89 THEN Grade = ‘良’
When Grade between 70 and 79 THEN Grade = ‘中’
When Grade between 60 and 69 THEN Grade = ‘及格’
Else Grade = ‘不及格’
End
; Case
When Grade between 90 and 100 THEN ‘优’
When Grade between 80 and 89 THEN ‘良’
When Grade between 70 and 79 THEN ‘中’
When Grade between 60 and 69 THEN ‘及格’
Else ‘不及格’
End
; Case Grade
When 90~100 THEN Grade = ‘优’
When 80~89 THEN Grade = ‘良’
When 70~79 THEN Grade = ‘中’
When 60~69 THEN Grade = ‘及格’
Else Grade = ‘不及格’
End”
“题目6:在SQL语句中,用于更新表数据的语句是( )。
: ALTER
; SELECT
; UPDATE
; INSERT”
“题目7:设有Teachers表,该表的定义如下:
CREATE TABLE Teachers(
Tno CHAR(8) PRIMARY KEY,
Tname VARCHAR(10) NOT NULL,
Age TINYINT CHECK(Age BETWEEN 25 AND 65) )
插入语句中,不能正确执行的是( )。
: INSERT INTO Teachers VALUES(‘T100′,’张宏’,NULL)
; INSERT INTO Teachers(Tno,Tname,Age) VALUES(‘T100′,’张宏’,30)
; INSERT INTO Teachers(Tno,Tname) VALUES(‘T100′,’张宏’)
; INSERT INTO Teachers VALUES(‘T100′,’张宏’)”
“题目8:设数据库中已有表5-1至5-3所示的Student、Course和SC表。现要查询学生选的第2学期开设课程的情况,只需列出学号、姓名、所在系和所选的课程号。该查询涉及到的表是( )。
: 仅Student表
; 仅Student和SC表
; 仅Student和Course表
; Student、SC和Course表”
“题目9:删除计算机系学生(在student表中)的修课记录(在SC表中)的语句,正确的是( )。
: DELETE FROM SC JOIN Student b ON S.Sno = b.Sno
WHERE Sdept = ‘计算机系’
; DELETE FROM SC FROM SC JOIN Student b ON SC.Sno = b.Sno
WHERE Sdept = ‘计算机系’
; DELETE FROM Student WHERE Sdept = ‘计算机系’
; DELETE FROM SC WHERE Sdept = ‘计算机系'”
“题目10:查询年龄最大的前5位学生的姓名和年龄的语句,正确的是( )。
: SELECT TOP 5 姓名, 年龄 FROM 学生表
; SELECT TOP 5 姓名, 年龄 FROM 学生表 ORDER BY 年龄
; SELECT TOP 5 姓名, 年龄 FROM 学生表 ORDER BY 年龄 DESC
; SELECT TOP 5 WITH TIES姓名, 年龄 FROM 学生表”
题目11:“SELECT * FROM Student WHERE Sname LIKE ‘张_’ ”语句中的’张_’ 用于查找姓张的学生。( )
题目12:“SELECT * FROM Student WHERE Sname LIKE ‘[张李刘]%’ ”语句可以查找姓张、李、刘的学生。( )
题目13: “SELECT COUNT(DISTINCT Sno) FROM SC ”语句用于统计学生的总人数。( )
题目14:HAVING子句用于对分组后的统计结果再进行过滤,它用于组而不是对单个记录。( )
“题目15: “SELECT * FROM Student INNER JOIN SC
ON Student.Sno = SC.Sno ” 语句可将Student与 SC连接起来。( )”
暂无评论内容