sqlserver期末复习选择题 联系客服

发布时间 : 星期日 文章sqlserver期末复习选择题更新完毕开始阅读3be86bbcf121dd36a32d82d5

sid 1 2 3 4 student sname Lee Chen Jack rose score sid 1 2 score 80 75 45) 46)

a) b) c) d) 0 2 4 6

定义列中可以接受的数据值或格式,称为()。(选择一项) a) 唯一性约束 b) 检查约束 c) 主键约束 d) 默认约束

假设订单表orders用来存储订单信息,cid代表客户编号,money代表单次订购额,现要查询每个客户的订购次数和每个客户的订购总金额,下面()sql语句可以返回正确结果。(选择一项)

select cid,count(distinct(cid)),sum(money) from orders group by cid a)

select cid,count(distinct(cid)),sum(money) from orders order by cid b)

select cid,count(cid),sum(money) from orders order by cid c)

select cid,count(cid),sum(money) from orders group by cid d)

Sql server提供了一些系统函数,以下说法错误的是()。(选择两项)

a) select datalength(‘ab cde’) 返回值为:5 b) select convert(char(3),12345) 返回值为:123 c) select datalength(‘abcde’) 返回值为:5 d) select convert(char(5),12345) 返回值为:12345 家庭住址最好采用()数据类型进行存储。

Char/Nchar a)

text/Ntext b)

Varchar/Nvarchar c)

Char2/Nchar2 d)

47) 48)

49)

50)

现有客户表customers(主键:客户编号cid),包含10行数据,订单表orders(外键:客户编号cid),包含6条数据。执行sql语句:select * from customers right outer join orders on customers.cid=orders.cid。最多返回()条记录。(选择一项)

10 a)

6 b)

4 c)

0 d)

假设一系统原来使用Access数据库,现要使用sql server数据库,采用()方法可以

完成两个数据库之间的数据转换工作。(选择一项) a) Sql server的附加数据库功能 b) Sql server的还原数据库功能 c) 在Sql server中可直接打开Access数据库,另存即可。 d) Sql server的导入\\导出功能

题号 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 答案 c A,b A,d C,d c A,d A,c b d c a d b c B,c C,d B,c a a B,c d d c B,c d 题号 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 答案 b b b d B,d a B,c A C,d b A,d A,d c c a B,d b c c b d A,b c b d 针对以下题目请选择正确答案(每道题目有一个或多个正确的答案)。针对每一道题目,所有答案都选对,则该题得分,所选答案错误或不能选出所有正确答案,则该题不得分,以下每题2分。

1)

为表userinfo添加约束,语法如下:

alter table userinfo add constraint uq_userid unique ( userid ) 执行成功后,为userinfo表的()字段添加了()约束。 a) Userid ; 主键 b) Userid ; 唯一 c) Uq_userid ;外键 d) Uq_userid ;检查

2)

3) 4)

运行如下T-SQL,结果返回包含()的记录集。 create table scores (

scoreid int identity(1,2), score numeric(4,2) not null, courseid int )

insert into scores values(90.5, null); insert into scores values(100, 2); select * from scores; a) 1、90.5、null

3、100、2

b) 1、100、2l c) 1、90.50、null d) 1、90.5、null

3、100.0、2

关于子查询,以下说法正确的是()。(选择两项) a) 一般来说,表连接都可以用子查询替换。 b) 一般来说,子查询都可以用表连接替换。 c) 相对于表连接,子查询适合于作为查询的筛选条件。 d) 相对于表连接,子查询适合于查看多表的数据。 创建存储过程如下:

CREATE procedure bookproc

@id int, @title char(20) OUTPUT as

select @title=title from book where id= @id 执行该存储过程的方法正确的是()。(选择一项)

exec bookproc 1,@title output a)

print @title

exec bookproc @id =1,@title output b)

print @title

declare @title char(20) c)

exec bookproc 1,@title output print @title

declare @title char(20) d)

exec bookproc @id =1,@title output print @title

假设需要设计一个表,记录各个作者著作的所有图书信息,表结构设计如下: 作者(作者名称、图书1、版本1、书价1、图书2、版本2、书价2、……), 该表最高符合第()范式。

5)