sqlserver期末复习选择题

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

24) 25) 26) 27) 28)

成绩表grade中字段score代表分数,以下()语句返回成绩表中的最低分。(选择两项)

select max(score) from grade a)

select top 1 score from grade order by score asc b)

Select min(score) from grade c)

select top 1 score from grade order by score desc d)

现有订单表orders,包含用户信息userid, 产品信息 productid, 以下()语句能够

返回至少被订购过两回的productid? (选择一项)

select productid from orders where count(productid)>1 a)

select productid from orders where max(productid)>1 b)

select productid from orders where having count(productid)>1 group by productid c)

select productid from orders group by productid having count(productid)>1 d)

关于聚合函数,以下说法错误的是()。(选择一项)

a) Sum返回表达式中所有数的总合,因此只能用于数字类型的列。 b) Avg返回表达式中所有数的平均值,可以用于数字型和日期型的列。 c) Max和Min可以用于字符型的列。 d) Count可以用于字符型的列。 使用Sql server提供的(),可以创建数据库。(选择一项) a) 查询分析器 b) 企业管理器 c) 服务管理器 d) 事件探查器

现有顾客表customers, 包含数据如下表,若执行sql语句:select count(distinct(city)) from customers,以下()是输出结果。(选择一项) cid cname city 1 2 3 4 jack lee tom chen null beijing beijing

a) b) c) d) 1 2 3 4

29) 现有顾客表customers, 包含数据如下表,若执行sql语句:select avg(discount) from customers,以下()是输出结果。(选择一项) cid cname discount 1 2 3 4 jack lee tom chen null 8 7 1

30) 31)

a) b) c) d) 错误提示:不能对null进行avg操作 16 8 4

Sql server提供了一些日期函数,以下说法错误的是()。(选择两项) a) select dateadd(mm,4,’01/01/99’) 返回值为:05/01/99 b) select datediff(mm,'03/06/2003','03/09/2003') 返回值为:3 c) select datepart(day,'03/06/2003') 返回值为:6 d) select datename(dw,'03/06/2003') 返回值为:6

现有书目表book,数据见下表。 现在执行sql语句:update book set title=replace(replace(title,'j','a'),'servlet','csharp'),执行结果是()。(选择一项) bookid title 1 2 3 4 jsp&servlet jsp Professional servlet asp

32)

a) b) c) d) 更新了3条记录 更新了2条记录 更新了1条记录

该sql语句有错误,无法执行

现有订单表orders, 包含数据如下表。若查询既订购了产品P01,又订购了产品P02的顾客编号,可以执行以下()sql语句。(选择两项) cid (顾客编号) Pid (产品编号) C01 C01 C02 C03 P01 P02 P01 P02

a) b) c) d) select distinct(cid) from orders o1 where o1.pid in ('p01','p02')

select distinct(cid) from orders o1,orders o2 where o1.pid='p01' and o2.pid='p02' and o1.cid=o2.cid

select distinct(cid) from orders o1 where pid='p01' and cid in (select cid from orders where pid ='p02')

select distinct(cid) from orders o1,orders o2 where o1.pid='p01' and o2.pid='p02'

33) 34) 35) 36) 37) 38)

使用以下()不可以进行模糊查询。(选择一项)

OR a)

Not between b)

Not IN c)

Like d)

关于分组查询,以下()描述是错误的。(选择两项)

a) 使用group by 进行分组查询 b) 对分组后的条件的筛选必须使用Having子句 c) Having子句不能与where子句同时出现在一个select语句中 d) 在使用分组查询时,在select列表中只能出现被分组的列。如:select courseid

from grade group by courseid. 关于多表联接查询,以下()描述是错误的。(选择一项) a) 外联接查询返回的结果集行数可能大于所有符合联接条件的结果集行数。 b) 多表联接查询必须使用到JOIN关键字 c) 内联接查询返回的结果是:所有符合联接条件的数据。 d) 在where子句中指定联接条件可以实现内联接查询。 Sql语句:select * from students where SNO like ‘010[^0]%[A,B,C]%’,可能会查询出的SNO是()。(选择两项)

01053090A a)

01003090A01 b)

01053090D09 c)

0101A01 d)

关于Truncate table, 以下()描述是错误的。(选择两项)

a) Truncate table 可跟Where从句,根据条件进行删除。 b) Truncate table 用来删除表中所有数据。 c) 触发器对Truncate table无效。 d) delete 比Truncate table速度快。

以下()说明了代码:not (付款方式=’信用卡’) or (信用卡<>’阳光卡’) 的含义。(选择一项) a) 付款方式不能是信用卡。 b) 付款方式不能是信用卡,或者信用卡是阳光卡。 c) 如果付款方式是信用卡,那么信用卡不能是阳光卡。 d) 付款方式是信用卡,并且信用卡不能是阳光卡。

39) 40) 41) 42)

执行Sql语句:select *, score*0.5+20 as 加权成绩 from grade where (score*0.5+20)<60 order by score*0.5+20,以下()描述是正确的。(选择一项) a) 错误提示:order by 子句中不能出现表达式。 b) 正确执行,显示grade表中各列值,按照score由低到高排序。 c) 正确执行,显示grade表中各列值,以及加权成绩列,按照score由低到高排

序。

d) 错误提示:where 子句中不能出现表达式。 创建一个名为‘Customers’的新表,同时要求新表中包含表‘clients’的所有记录,sql语句是()。(选择一项)

Select * into customers from clients a)

Select into customers from clients b)

Insert into customers select * from clients c)

Insert customers select * from clients d)

关于主键,以下()说法是错误的。(选择两项)

a) 主键可以用来确保表中不存在重复的数据行。 b) 一个表必须有一个主键。 c) 一个表只能有一个主键。 d) 只能对整数型列设置主键。

表book中包含三个字段:title(varchar), author(varchar), price(float)。Author的默认值是’UNKNOW’,执行sql语句:insert book (title,price) values (‘jsp’, 50)。以下结果正确的是()。(选择一项) a) 插入失败,sql语句有错 b) 插入成功,author列的数据是UNKNOW c) 插入成功,author列的数据是NULL d) 插入成功,author列的数据是50 关于sql server常用的数据类型,以下()说法是错误的。(选择一项) a) Image数据类型可以用来存储图像。 b) 使用字符数据类型时,可以改变长度信息。 c) 使用数字数据类型时,可以改变长度信息。 d) Bit数据类型为1位长度,可以存储表示是/否的数据。

现有学生表student(主键:学生编号sid),成绩表score(外键:学生编号sid), 两表中的数据如下。执行sql语句:select * from student st left outer join score sc on st.sid=sc.sid。正确的返回结果是()条记录。(选择一项)

43) 44)

联系合同范文客服:xxxxx#qq.com(#替换为@)