SQLSERVER内部测试.docx

上传人:b****2 文档编号:3087477 上传时间:2023-05-05 格式:DOCX 页数:23 大小:192.55KB
下载 相关 举报
SQLSERVER内部测试.docx_第1页
第1页 / 共23页
SQLSERVER内部测试.docx_第2页
第2页 / 共23页
SQLSERVER内部测试.docx_第3页
第3页 / 共23页
SQLSERVER内部测试.docx_第4页
第4页 / 共23页
SQLSERVER内部测试.docx_第5页
第5页 / 共23页
SQLSERVER内部测试.docx_第6页
第6页 / 共23页
SQLSERVER内部测试.docx_第7页
第7页 / 共23页
SQLSERVER内部测试.docx_第8页
第8页 / 共23页
SQLSERVER内部测试.docx_第9页
第9页 / 共23页
SQLSERVER内部测试.docx_第10页
第10页 / 共23页
SQLSERVER内部测试.docx_第11页
第11页 / 共23页
SQLSERVER内部测试.docx_第12页
第12页 / 共23页
SQLSERVER内部测试.docx_第13页
第13页 / 共23页
SQLSERVER内部测试.docx_第14页
第14页 / 共23页
SQLSERVER内部测试.docx_第15页
第15页 / 共23页
SQLSERVER内部测试.docx_第16页
第16页 / 共23页
SQLSERVER内部测试.docx_第17页
第17页 / 共23页
SQLSERVER内部测试.docx_第18页
第18页 / 共23页
SQLSERVER内部测试.docx_第19页
第19页 / 共23页
SQLSERVER内部测试.docx_第20页
第20页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

SQLSERVER内部测试.docx

《SQLSERVER内部测试.docx》由会员分享,可在线阅读,更多相关《SQLSERVER内部测试.docx(23页珍藏版)》请在冰点文库上搜索。

SQLSERVER内部测试.docx

SQLSERVER内部测试

SQLSERVER内部测试

一.选择题

1.sqlserver2005中,()关键字标志着批处理的结束。

(选择一项)

A.end

B.go

C.finish

D.print

2.sqlserver2005中,使用t-sql编程时,下列()语句可以从while语句块中退出。

(选择一项)

A.continue

B.exit

C.break

D.close

3.sqlserver2000中,使用t_sql编程时,对变量赋值可以使用()或()语句。

(选择一项)

A.setselect

B.printselect

C.setmake

D.printset

4.sqlserver2005中,要对用户表(user)建立一个约束,保证注册日期(registerdata)默认使用系统当前日期,下面语句正确的是()。

(选择一项)

A.altertableuseraddconstraintck_datecheck(registerdate=getdate())

B.altertableuseraddconstraintdf_datedefault(getdate())

C.altertableuseraddconstraintdf_datedefault(getdate())forregisterdate

D.altertableuseraddconstraintdf_datedefault(registerdate=getdate())

5.在sqlserver2005的中,给定创建视图的代码如下:

createviewabcd___select*fromsaleswhereqty>90

则下划线处应填写的正确关键字为()。

(选择一项)

A.on

B.as

C.alter

D.for

6.在sqlserver2005中,对存储过程的描述中正确的是()。

(选择一项)

A.定义了一个有相关列和行的集合

B.它根据一列或多列的值,提供对数据库表的行的快速访问

C.当用户修改数据时,一种特殊形式的存储过程被自动执行

D.sql语句的预编译集合

7.sqlserver2000中,创建存在储过程的片断如下:

创建成功后,以下()调用方式是正确的。

(选择一项)

createprocedureproc_score

@passedint=60,

@countintoutput

as

select@count=count(*)fromscorewherescore<@passed

A.executeproc_score@countintoutput

B.declare@countintexecuteproc_score70,@countoutput

C.declare@countintoutputexecuteproc_score70,@countt

D.executeproc_score@passed=70,@countoutput

8.在sqlserver查询分析器中运行t-sql语句:

select@@identity

其输出值()。

(选择一项)

A.A.可能为0.1

B.B.可能为3

C.C.肯定为0

D.D.不可能为-100

9.在sqlserver2005中,以下()是t-sql语句的注释符号。

(选择一项)

A.//

B.--

C.///

D.*

10.sqlserver2005中,在存储过程中,()语句用来向用户报告错误,并可指定严重级别。

(选择一项)

A.print

B.error

C.raiserror

D.raise

11.在sqlserver2005中,执行以下的t-sql:

begintransaction

ifexists(selecttitle_idfromtitleswheretitle_id='fc2')

begin

deletetitleswheretitle_id='tc2'

rollbacktransaction

print'ok'

end

若能找到title_id的tc2的记录,将()。

(选择一项)

A.删除该记录行,不打印任何信息

B.不删除该记录行,并且打印ok

C.删除该记录行,并且打印ok

D.不除该记录行,也不打印任何信息

12.在sqlserver2000中,根据以下表设计的代码,判断其设计方面的问题是()。

createtablemember(

last_namechar(20)null,

first_namevarchar(30)notnull,

address_line1varchar(30)null,

address_line2varchar(30)null,

address2_line1varchar(30)notnull,

address2_line2char(30)null,

book_idintnull)(选择一项)

A.应该把所有的null修改为notnull,而且把notnull修改为null

B.该表有进一步规范化的必要

C.把book_id设为主键

D.所以字段都应允许为空

13.在sqlserver2000中,在products(产品)表,包含字段:

pname(产品名称)、price(价格)。

若要得到最贵产品的产品名称和产品价格,应该使用的查询语句是()。

(选择一项)

A.A.selecttop1pname,pricefromproductsorderbyprice

B.B.selectpname,max(price)fromproducts

C.C.selectpname,max(price)fromproductsgroupbypname

D.D.selectpname,pricefromproductswhereprice=(selectmax(price)fromproduct)

14.在sqlserver2000数据库中,执行如下的sql语句,将().

print'服务器为:

'+@@servicename

A.A.在网格窗口以网格的方式显示当前计算机上的sql服务名称

B.B.在消息窗口以文本的方式显示当前计算机上的sql服务名称

C.C.在网格窗口以网格的方式显示本地服务名称

D.D.在消息窗口以文本的方式显示本地服务名称

15.在sqlserver2000数据库中,关于视图的说法错误的是()。

A.A.视图是一个可以虚拟的表,在物理介质上并不存在

B.B.视图可以查看来自一个或多个表的内存

C.C.修改了视图的数据,原始数据并不会被修改

D.D.使用creatview来创建视图

16.sqlserver2000中。

已知有student表,表中共有10条status列值为0的记录。

创建试图。

命令执行的结果是()

createviewview1

as

select*fromstudentwherestatus=0

视图创建成功后,执行如下命令:

updataview1setstatus=1;

select*fromview1;

A.A.错误提示:

不能对视图执行更新操作

B.B.错误提示:

不能对视图执行查询操作

C.C.返回10条记录

D.D.返回0条记录

17.数据库设计时,在做表规范化的时候一般规范到()就足够了。

(选择一项)

A.第一范式

B.第三范式

C.第四范式

D.第五范式

18.在sqlserver2000中,为数据库表建立索引能够()。

(选择一项)

A.防止非法的删除操作

B.防止非法的插入操作

C.提高查询性能

D.节约数据库的磁盘空间

19.在sqlserver2005中,已知student表中有一个age列,数据类型是int,如果要限制该列的取值范围在15到30之间,可以使用以下sql

A.altertablestudentaddcheck(age>=15andage<=30)

B.altertablestudentadddefault(age>=15andage<=30)

C.altertablestudentaddunique(age>=15andage<=30)

D.altertablestudentaddset(age>=15andage<=30)

20.sqlserver2005中,使用t-sql编程时,输出结果有两种方式:

()或()语句。

(选择一项)

A.setselect

B.printselect

C.setmake

D.printset

21.在sqlserver2005中,给定如下的t-sql:

declare@abcint

declare@xyzint

set@abc=10

while@abc<=100

begin

set@xyz=

casefloor(@abc/30)

when0then@abc*5

when1then@abc*10

else@abc*20

end

set@abc=@xyz

end

print@xyz

程序最后输出的结果是()。

(选择一项)

A.50

B.500

C.100

D.以上都不对

22.在sqlserver2005的查询分析器中运行以下的t-sql:

(选择一项) 

selectdistinctt1.typefromtitlest1wheret1.typein

(selecttypefromtitleswheret1.pub_id<>pub_id)

A.查询成功,但是将查询不到任何数据行

B.查询成功,可能能够查询到一行或者多行数据

C.查询失败,因为在同一张表中进行查询和子查询必须使用表的别名

D.查询失败,因为不能同时在一张表中执行多次查询

23.在sqlserver2000中,可以使用全局变量()来获得最后一次插入的标识值。

(选择一项)

A.@@datefirst

B.@@identity

C.@@transcount

D.@@rowcount

24.sqlserver2005中,在查询分析器中调用()系统存储过程可以修改数据库的名称。

(选择一项)

A.sp_databases

B.sp_renamedb

C.sp_tables

D.sp_rename

25.在sqlserver2000数据库中,表stuinfo的属性列stuaddress表示学生居住地址,对stuaddress添加了如下的约束,其意义是()。

(选择一项)

altertablestuinfo

addconstraintdf_sinaddressdefault(‘待定不详’)forstuaddress

A.stuaddress列不允许为空,已经存在的记录,如果该列为空,则自动填写“待定不详”

B.添加新记录时,如果stuaddress列不填,默认填写“待定不详”

C.stuaddress列全部修改填写为“待定不详”

D.将stuaddress列值为“待定不详”的记录全部划为非法,予以删除

26.在sqlserver2005数据库中,表student中有字段stuname和stuage,与如下语句等值的sql语句为()。

假设表中姓名列可以有重复的值.

declare@ageint

select@age=stuagefromstudentwherestuname='杨超'

select*fromstudentwherestuage=@age(选择一项)

A.select*fromstudentwherestuname=‘杨超’adnstuage=(selectstuagefromstudentwherestuname=‘杨超’)

B.select*fromstudentwherestuage=(selectstuagefromstudentwherestuname=‘杨超’)

C.select*fromstudentwherestuagein(selectstuagefromstudentwherestuname=‘杨超’)

D.declare@ageint

select*fromstudentwherestuage=(select@age=stuagefromstudentwherestuname=‘杨超’)

27.在sqlserver2005中,以下是表autos的定义:

createtableautos(makevarchar(20)notnull,modelvarchar(20)notnull,

acquisition_costmoneynull,acquisition_datedatetimenull)

创建该表后再执行以下语句:

truncatetableautos

begintran

insertautos(make,model)values('tucker','torpedo')

ifexists(select*fromautos)

rollbacktran

else

committran

执行结果是()。

(选择一项)

A.该批处理将失败,因为begintran…committran没有正确嵌套

B.该批处理结束后,表内没有数据行

C.该批处理结束后,表内有一行数据

D.插入数据行的语句将失败,并且提示错误信息

28.在sqlserver2005中,创建视图view_b的代码为()。

(选择一项)

A.createviewview_basselect*fromtable_a

B.createview_basselect*fromtable_a

C.createviewview_bforselect*fromtable_a

D.createview_bforselect*fromtable_a

29.在sqlserver2005中,从product表里查询出price(价格)高于pname(产品名称)为“一次性纸杯”的所有记录,此sql语句为()。

(选择一项)

A.select*fromproductwheremax(price)>'一次性纸杯'

B.select*fromproductwhereprice>(selectmax(*)fromproductwherepname='一次性纸杯')

C.select*fromproductwhereexistspname='一次性纸杯'

D.select*fromproductwhereprice>(selectmax(price)fromproductwherepname='一次性纸杯')

30.在sqlserver2005中,要创建一个product(产品)表,包括三个字段:

pid(编号)int,pname(名称)char(20),qty(数量)int要求:

pid设为标示列,列值从1开始,每次自动加1:

产品的数量应总是正的值。

下列sql语句能满足上述条件的是()。

(选择一项)

A.createtableproduct(pidintidentiy(1,1),pnamechar(20)notnull,qtyintnotnullconstraintchkqtycheck(qty>0))

B.createtableproduct(pidintnotnullconstraindefproductiddefault1,pnamechar(20)notnull,qtyintnotnullconstraintchkqtycheck(qty>0))

C.createtableproduct(pidintidentiy(1,1),pnamechar(20)notnull,qtyintnotnullconstraintchkqtyunique(qty>0))

D.createtableproduct(pidintnotnullconstraindefproductiddefault1,pnamechar(20)notnull,qtyintnotconstraintchkqtyunique(qty>0))

31.在sqlserver2005中,与下列t-sql语句等效的语句为()。

(选择一项)

updateaseta1=a1*2wherea2in(selecta2frombwhereb1=2)

A.updateaseta1=a1*2innerjoinbonb.b1=2

B.updateaseta1=a1*2fromainnerjoinbonb.b1=2

C.updateaseta1=a1*2whereainnerjoinbona.a2=b.a2andb.b1=2

D.updateaseta1=a1*2fromainnerjoinbona.a2=b.a2andb.b1=2

32.在sqlserver2000中,声明一个最多可以存储5个字符的变量a,正确的代码是()。

(选择一项)

A.declareavarchar(5)

B.declare@avarchar(5)

C.avarchar(5)

D.@avarchar(5)

33.在sqlserver的安全管理过程中,以下()的概念类似于windows中的用户。

(选择一项)

A.权限

B.登录帐户

C.角色

D.存储过程

34.sqlserver2005中,已知执行语句:

selectcount(score),sum(score)fromscore返回的结果是10和750,那么执行语句:

selectavg(score)fromscore,返回的结果是()。

(选择一项)

A.10

B.75

C.750

D.7500

35.在sqlserver2005中,与以下t-sql等效的是()。

(选择一项)

updatetitlesssetprice=price*1.05wherepub_idin(selectpub_idfrompublishers)

A.updatetitlessetprice=price*1.05whereexists(selectpub_idfrompublishers)

B.updatetitlessetprice=price*1.05fromtitleswherepub_idinpublishers.pub_id

C.updatetitlessetprice=price*1.05wheretitles.pub_id=publishers.pub_id

D.updatetitlessetprice=price*1.05formtitlesinnerjoinpublishersontitles.pub_id=publishers.pub_id

36.在sqlserver2000中给定如下的t-sql代码,以下说法正确的是()。

(选择一项)

createprocedureprice_proc

(@countintoutput,@avg_pricemoneyoutput,@typechar(12)='business')

as

select@count=count(*),@avg_price=avg(price)fromtitleswheretype=@type

A.建立一个存储过程price_proc,所有参数都是输出参数

B.建立一个存储过程price_proc,返回的是用户指定图书种类的数量及平均价格

C.@count=count(*)也可以用@count=count()代替

D.创建存储过程失败,因为select语句中使用了聚合函数,因此必须使用groupby进行分组

37.现有表名称为score,有一个名称为teacher的用户名。

要求授予表的插入和修改的权限,正确的授权语句是()。

(选择一项)

A.grantinsert,updatetotablescoreonteacher

B.grantinsertandupdatetotablescoreonteacher

C.grantinsert,updateonscoretoteacher

D.grantinsertandupdateonscoretoteacher

38.已知有student表,studentid为主键,现在表中共有10行记录,studentid列值从1到10。

创建视图:

createviewdbo.view_studentasselect*fromdbo.student接着执行如下命令:

deletefromview_studentwhere(studentid=8);然后执行查询命令:

select*fromstudent;select*fromview_student;假定上述命令全部执行成功,将各自返回()()行记录。

A.10,10

B.10,9

C.9,10

D.9,9

39.sqlserver数据库中,包含两个表:

order订单表,item订单子项目表。

当一个新定单被加入时,数据要分别保存到o

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2