2、下列sql语句中,能够实现“收回用户zhao对学生表(stud)中学号(xh)的修改权”这一功能的是( )。 a、revoke update(xh) on table from zhao b、revoke update(xh) on table from public c、revoke update(xh) on stud from zhao d、revoke update(xh) on stud from
5、把对关系spj的属性qty的修改权授予用户李勇的t-sql语句是( )。 a、grant qty on spj to '李勇' b、grant update(qty) on spj to '李勇' c、grant update (qty) on spj to 李勇 d、grant update on spj (qty) to '李勇'
6、学生关系模式 s (sno,sname,sex,age),s的属性分别表示学生的学号、姓名、性别、年龄。要在表s中删除属性“age”,可选用的sql语句是( )。 a、delete age from s b、alter table s drop age c、update s age d、alter table s age
7、有关系s(sno, sname, sage),c(cno, cname),sc(sno, cno, grade)。其中sno是学生号,sname是学生姓名,sage是学生年龄, c#是课程号,cname是课程名称。要查询选修“access”课的年龄不小于20的学生姓名,则sql语句是: select sname from s,c,sc where子句。 这里的where子句的内容是( )。 a、s.sno = sc.sno and c.cno = sc.cno and sage>=20 and cname=‘access’ b、s.sno = sc.sno and c.cno = sc.cno and sage in>=20 and cname in ‘access’ c、sage in>=20 and cname in ‘access’ d、sage>=20 and cname=’ access’
8、在关系代数的基本运算中,交、连接、除这三种运算可用其它五种运算来表达,以下描述正确的是( )。 a、r ç s = r – (r – s) b、r ¥xqy s = σ xqy(r´s) c、r(x, y) ¸s(y, z) =пx(r)–пx(пx(r)´пy(s)-r) d、r(x, y) ¸s(y, z) =пx(r)–пx(пx(r)´пy(s))
10、10. 设有一个学生选课数据库,其包括学生表s、课程表c和学生选课表sc三个关系: s (sno, sname, sage, sdep); c (cno, cname); sc (sno, cno, grade)。 其中sno是学生号,sname是学生姓名,sage是年龄, sdep是学生所在系,cno是课程号,cname是课程名称。 “查询计算机科学系年龄介于15岁至19岁之间的学生”,其sql语句为( )。 a、select * from s where sdep = ‘cs’ and sage between 15 and 19; b、select * from s where sdep = ‘cs’ and sage <= 19 and sage >= 15; c、select * from s where sdep = ‘cs’ or sage between 15 and 19; d、select * from s where sdep = ‘cs’ and sage <= 19 or sage >= 15;
综合测试2
第二次考试
1、如无特殊说明,本次考试所涉及的题目均基于如下描述: 设有一个学生选课数据库,其包括学生表s、课程表c和学生选课表sc三个关系: s(sno, sname, sage, ssex, sdep); c(cno, cname); sc(sno, cno, grade)。 其中sno是学生号,sname是学生姓名,sage是年龄,sdep是学生所在系,cno是课程号,cname是课程名称。 检索所有比“刘晨”年龄大的学生姓名、年龄和性别。正确的select语句是()。 a、select sname, sage, ssex from s where sage > (select sage from s where sname = '刘晨'); b、select sname, sage, ssex from s where sname = '刘晨'; c、select sname, sage, ssex from s where sage> (select sage where sname = "刘晨"); d、select sname, sage, ssex from s where sage>'王华'.sage;
2、检索选修课程“c2”的学生中成绩最高的学生的学号。正确的select语句是()。 a、select sno form sc where cno='c2' and grade >= ( select grade form sc where cno='c2' ); b、select sno form sc where cno='c2' and grade in ( select grade form sc where cno='c2' ); c、select sno form sc where cno='c2' and grade not in ( select grade form sc where cno='c2' ); d、select sno form sc where cno='c2' and grade >= all ( select grade form sc where cno='c2' );
3、检索选修四门以上课程的学生总成绩,并要求按总成绩的降序排列出来。正确的select语句是()。 a、select sno, sum (grade) from sc group by sno order by 2 desc having count(*) >= 4; b、select sno, sum (grade) from sc group by sno having count(*)>=4 order by 2 desc; c、select sno, sum (grade) from sc having count(*)>=4 group by sno order by 2 desc; d、select sno, sum (grade) from sc order by 2 desc group by sno having count(*)>=4;
5、“查询与‘刘晨’在同一个系学习的学生”的sql语句为()。 a、select sno, sname, sage, ssex, sdep from s where sdep in (select sdep from s where sname = '刘晨'); b、select * from s where sdep in (select sdep from s where sname ='刘晨'); c、select sno, sname, sage, ssex, sdep from s where sname = '刘晨'; d、select s1.sno, s1.sname, s1.sage, s1.ssex, s1.sdep from s s1, s s2 where s1.sdept = s2.sdept and s2.sname = '刘晨';
6、“查询计算机科学系年龄大于19岁的学生”的sql语句为()。 a、select * from s where sdep = ‘cs’ except select * from s where sage<=19; b、select * from s where sdep = 'cs' and sage > 19; c、select * from s where sdep = 'cs' and sage <= 19; d、select * from s where sdep != 'cs' and sage <= 19;