2011-2012学年武汉新华期末考试试卷(闭卷)
注意:1、本试卷共页; 2、考试时间:90分钟 3、姓名、学号必须写在指定地方。
一、单选题(每小题2分,共30分,请将答案填写在题号前面的括号里)
1. 查询选修了课程号为201的学生的学号和姓名,以下sql语句哪个是错误的( )
学号,姓名from xs where 学号=(select 学号 from xs_kc where 课程号=’201’);
xs.学号,xs.姓名 from xs,xs_kc where xs.学号=xs_kc.学号 and课程号=’201’;
c. select xs.学号,xs.姓名 from xs join xs_kc on xs.学号=xs_kc.学号 where xs_kc.课程号=’201’;
d. select 学号,姓名from xs where 学号 in(select 学号 from xs_kc where 课程号=’201’);
2.在sql语句中与表达式“工资between 2000 and 3000”功能相同的表达式相同的是( )
a.工资》=2000 and工资<=3000b.工资》2000 and 工资<3000;
c.工资<=2000 and 工资》3000d.工资》=2000 or工资<=3000;
3.如要删除数据库中xs表中的数据使用( )
table from xs;
table xs.
4.若要向xs表中增加一列mz(民族)可用( )
table xs(mz char(2b. alter table xs add (mz char(2))
c. add table xs alter(mz char( table xs (add mz char(2))
5.查询所有目前年龄在25岁以上的学生信息(姓名、性别和年龄)正确编码为( )
姓名,性别,year(getdate())year(出生日期) as 年龄 from xs where 年龄》25;
姓名,性别,year(getdate())year(出生日期) as 年龄 from xs where year(出生日期)>25;
姓名,性别,year(getdate())year(出生日期) as 年龄 from xs where year(getdate())year(出生日期) >25;
姓名,性别,年龄=year(date())year(出生日期) from xs where year(getdate())year(出生日期) >25;
6.查询xs表中学号尾号是1的错误编码为( )
* from xs where substring(学号,5)=’1’
* from xs where substring(学号,5,1)=’1’;
* from xs where 学号 like ‘%1’;
* from xs where right(学号,1)=’1’.
server 2005触发器主要针对下列语句创建( )
insert update create;
update update delete.
8.在sql server中触发器不具有( )类型。
触发器触发器;
触发器触发器。
9.使用sql语句从xs表中查询所有性张的同学的信息,正确的命令是()
* from xs where left(姓名,1)='张';
* from xs where right(姓名,1)='张';
* from xs where trim(姓名,1)='张';
* from xs where str(姓名,1)='张'.
10.使用模糊查询xs表中所有张姓的同学的信息,正确命令的是()
* from xs where 姓名 like '张%';
* from xs where like 姓名='张%';
* from xs where 姓名 like '张_';
* from xs where like 姓名= '张_'.
11.查询xs表中2024年01月01日出生的学生信息的正确命令为()
* from xs where 出生日期={1980-01-01};
* from xs where 出生日期='1980-01-01';
* from xs where 出生日期="1980-01-01";
* from xs where 出生日期=1980-01-01.
12.假设xs表中有10条记录,获得员工表最前面6条记录的命令为()
2 * from top 6 * from xs;
percent 2 * from percent2.0 * from xs.
13.在sql语句中与表达式“课程名 not in('计算机基础','网络工程')”功能相同的是()
a.课程名=' 计算机基础' and 课程名='网络工程';
b.课程名=' 计算机基础' or 课程名='网络工程';
c.课程名!='计算机基础' and 课程名!='网络工程';
d.课程名!='计算机基础' or 课程名!='网络工程'.
14.如果xs表使用如下语句创建。
create table xs (
sno char(4) primary key not null,sname char(8),ssex char(2),sage int check(sage>15 and sage<30)
则下面的sql语句可以正确执行的是()
into xs (ssex,sage)values('男',17);
into xs (sno,ssex,sage)values('张三','男',18);
into xs (sno,ssex,sage)values('s9','男',19);
into xs (sno,sname)values('s9','张三',20).
15.使用t-sql语句()来申明游标。
cursor
cursor
二、多选题(每小题3分,共15分)
1.@n是使用declare语句声明的一个局部变量,能对该变量赋值的语句是( )
@n = 123;
@n = 123;
@n = 123;
d.@n = 123.
2. 下列语句可以成功执行的有( )
* from xs,kc where xs.学号=kc.课程号;
* from xs,xs_kc where xs.学号=kc.学号;
* from xs inner join xs_kc on xs.学号=kc.学号;
* from xs inner join xs_kc where xs.学号=kc.学号。
3.查询选修了101课程且成绩在75分以上的学生姓名及成绩为相同的功能的语句( )
a. select xs.姓名,xs_kc.课程号,xs_kc.成绩 from xs inner join
xs_kc on xs.学号=xs_kc.学号 and xs_kc.课程号 = 101' and xs_kc.成绩》=75;
b. select xs.姓名,xs_kc.课程号,xs_kc.成绩 from xs,xs_kc
where xs.学号=xs_kc.学号 and xs_kc.课程号 = 101' and xs_kc.成绩》=75;
c. select a.姓名,b.课程号,b.成绩 from xs a inner join
xs_kc b on a.学号=b.学号 and b.课程号 = 101' and b.成绩》=75;
d. select xs.姓名,xs_kc.课程号,xs_kc.成绩 from xs inner join
xs_kc on xs.学号=xs_kc.学号 on xs_kc.课程号 = 101' on xs_kc.成绩》=75.
4.以下为数据库或数据表命名正确的是( )
a.123datebase_name 或 123table_name; 或 table_name123;
数据库试卷B答案
合肥学院20 10 至20 11 学年第 2 学期 数据库原理与应用课程考试 b 卷答案。一 填空题 每空1分 1 数据,软件,系统 2 外模式,模式,内模式,模式,外模式,模式,内模式。3 属性,自然连接会删除多余的属性。4 非空,主键,唯一性,外键,缺省值,检查 任选3个 5 集成模式,混合模式...
2019《数据库技术》B卷
华中科技大学 2009级大机械类课程。数据库技术 考试试卷 b卷 2011年9月。姓名学号院系班级。说明 1.本试卷共四道大题,满分100分 2.闭卷考试,考试时间为150分钟。1 若关系中的某一属性组的值能唯一地标识一个元组,则称该属性组为。a.候选码 b.关系 c.基本属性 d.外码。2 在人工...
《数据库应用》2019卷B
数据库应用 2006期终考试试卷b2 1 通常所说的数据库系统 dbs 是指引入了后的计算机系统。2 包含在数据库中的表称为否则称为表。3 表中简历字段的宽度为 其内容存储于名为的文件内。4 的结构化复合索引文件名为。5 abc ab ab abc 和 abc ab 的值分别为。6 若w b a执行...