国家开放大学24秋《数据库应用技术》第5章测验[答案] 题目类型: 单选题 题目: 当关系r和s进行连接操作时,如果r中的元组不满足连接条件,在连接结果中也会将这些记录保留下来的操作是 选项
国家开放大学24秋《数据库应用技术》第5章 测验[答案]
题目类型:
单选题
题目:
当关系r和s进行连接操作时,如果r中的元组不满足连接条件,在连接结果中也会将这些记录保留下来的操作是
选项:
左外连接
右外连接
内连接
自连接
题目类型:
单选题
题目:
聚合函数中,不忽略空值的是
选项:
sum(列名)
max(列名)
avg(列名)
count(*)
题目类型:
单选题
题目:
查询语句中,错误的是
选项:
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
题目类型:
单选题
题目:
现要利用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
题目类型:
单选题
题目:
设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
题目类型:
单选题
题目:
在sql语句中,用于更新表数据的语句是
选项:
alter
select
update
insert
题目类型:
单选题
题目:
设有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 teachersvalues('t100','张宏')
题目类型:
单选题
题目:
设数据库中已有表5-1至5-3所示的student、course和sc表.现要查询学生选的第2学期开设课程的情况,只需列出学号、姓名、所在系和所选的课程号.该查询涉及到的表是
选项:
仅student表
仅student和sc表
仅student和course表
student、sc和course表
题目类型:
单选题
题目:
删除计算机系学生(在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 = '计算机系'
题目类型:
单选题
题目:
查询年龄最大的前5位学生的姓名和年龄的语句,正确的是
选项:
select top 5 姓名, 年龄 from 学生表
select top 5 姓名, 年龄 from 学生表 order by 年龄
select top 5 姓名, 年龄 from 学生表 order by 年龄 desc
select top 5 with ties姓名, 年龄 from 学生表
题目类型:
判断题
题目:
select * from student where sname like '张_' 语句中的'张_' 用于查找姓张的学生.
选项:
对
错
题目类型:
判断题
题目:
select * from student where sname like '[张李刘]%' 语句可以查找姓张、李、刘的学生.
选项:
对
错
题目类型:
判断题
题目:
select count(distinct sno) from sc 语句用于统计学生的总人数.
选项:
对
错
题目类型:
判断题
题目:
having子句用于对分组后的统计结果再进行过滤,它用于组而不是对单个记录.
选项:
对
错
题目类型:
判断题
题目:
select * from student inner join sc on student.sno = sc.sno 语句可将student与 sc连接起来.
选项:
对
错
题目类型:
单选题
题目:
当关系r和s进行连接操作时,如果r中的元组不满足连接条件,在连接结果中也会将这些记录保留下来的操作是
选项:
左外连接
右外连接
内连接
自连接
题目类型:
单选题
题目:
聚合函数中,不忽略空值的是
选项:
sum(列名)
max(列名)
avg(列名)
count(*)
题目类型:
单选题
题目:
查询语句中,错误的是
选项:
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
题目类型:
单选题
题目:
现要利用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
题目类型:
单选题
题目:
设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
题目类型:
单选题
题目:
在sql语句中,用于更新表数据的语句是
选项:
alter
select
update
insert
题目类型:
单选题
题目:
设有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 teachersvalues('t100','张宏')
题目类型:
单选题
题目:
设数据库中已有表5-1至5-3所示的student、course和sc表.现要查询学生选的第2学期开设课程的情况,只需列出学号、姓名、所在系和所选的课程号.该查询涉及到的表是
选项:
仅student表
仅student和sc表
仅student和course表
student、sc和course表
题目类型:
单选题
题目:
删除计算机系学生(在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 = '计算机系'
题目类型:
单选题
题目:
查询年龄最大的前5位学生的姓名和年龄的语句,正确的是
选项:
select top 5 姓名, 年龄 from 学生表
select top 5 姓名, 年龄 from 学生表 order by 年龄
select top 5 姓名, 年龄 from 学生表 order by 年龄 desc
select top 5 with ties姓名, 年龄 from 学生表
题目类型:
判断题
题目:
select * from student where sname like '张_' 语句中的'张_' 用于查找姓张的学生.
选项:
对
错
题目类型:
判断题
题目:
select * from student where sname like '[张李刘]%' 语句可以查找姓张、李、刘的学生.
选项:
对
错
题目类型:
判断题
题目:
select count(distinct sno) from sc 语句用于统计学生的总人数.
选项:
对
错
题目类型:
判断题
题目:
having子句用于对分组后的统计结果再进行过滤,它用于组而不是对单个记录.
选项:
对
错
题目类型:
判断题
题目:
select * from student inner join sc on student.sno = sc.sno 语句可将student与 sc连接起来.
选项:
对
错