SQLSERVER内部测试 - 图文

发布时间 : 星期六 文章SQLSERVER内部测试 - 图文更新完毕开始阅读

A. 防止非法的删除操作 B. 防止非法的插入操作 C. 提高查询性能

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

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

A. alter table student add check(age>=15 and age<=30) B. alter table student add default(age>=15 and age<=30) C. alter table student add unique (age>=15 and age<=30) D. alter table student add set (age>=15 and age<=30)

20.sql server 2005中,使用t-sql编程时,输出结果有两种方式:()或()语句。(选择一项)

A. set select B. print select C. set make D. print set

21.在sql server 2005中,给定如下的t-sql: declare @abc int declare @xyz int set @abc=10 while @abc<=100 begin

set @xyz=

case floor(@abc/30)

when 0 then @abc*5

when 1 then @abc*10 else @abc*20 end

set @abc=@xyz end

print @xyz

程序最后输出的结果是()。(选择一项)

A. 50 B. 500 C. 100

D. 以上都不对

22.在sql server2005的查询分析器中运行以下的t-sql: (选择一项)

select distinct t1.type from titles t1 where t1.type in

(select type from titles where t1.pub_id<>pub_id)

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

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

C. 查询失败,因为在同一张表中进行查询和子查询必须使用表的别名 D. 查询失败,因为不能同时在一张表中执行多次查询

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

A. @@datefirst B. @@identity C. @@transcount D. @@rowcount

24.sql server 2005中,在查询分析器中调用()系统存储过程可以修改数据库的名称。(选择一项)

A. sp_databases B. sp_renamedb C. sp_tables D. sp_rename

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

add constraint df_sinaddress default(‘待定不详’) for stuaddress

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

B. 添加新记录时,如果stuaddress列不填,默认填写“待定不详” C. stuaddress列全部修改填写为“待定不详”

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

26.在sql server2005数据库中,表student中有字段stuname和stuage,与如下语句等值的sql语句为()。假设表中姓名列可以有重复的值. declare @age int

select @age=stuage from student where stuname='杨超'

select * from student where stuage=@age (选择一项)

A. select * from student where stuname=‘杨超’adn stuage=(select stuage from student where stuname=‘杨超’)

B. select * from student where stuage = (select stuage from student where stuname=‘杨超’)

C. select * from student where stuage in (select stuage from student where stuname=‘杨超’)

D. declare @age int

select * from student where stuage=(select @age=stuage from student where stuname=‘杨超’)

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

create table autos(make varchar(20)not null,model varchar(20)not null, acquisition_cost money null,acquisition_date datetime null) 创建该表后再执行以下语句: truncate table autos begin tran

insert autos(make,model) values('tucker','torpedo') if exists (select * from autos) rollback tran else

commit tran 执行结果是()。(选择一项)

A. 该批处理将失败,因为begin tran?commit tran没有正确嵌套 B. 该批处理结束后,表内没有数据行 C. 该批处理结束后,表内有一行数据

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

28.在sql server 2005中,创建视图view_b的代码为()。(选择一项)

A. create view view_b as select * from table_a B. create view_b as select * from table_a

C. create view view_b for select * from table_a D. create view_b for select * from table_a

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

A. select* from product where max(price)>'一次性纸杯'

B. select* from product where price>(select max(*) from product where pname='一次性纸杯')

C. select* from product where exists pname='一次性纸杯'

D. select* from product where price>(select max(price) from product where pname='一次性纸杯')

30.在sqlserver 2005中,要创建一个product (产品)表,包括三个字段:pid(编号)int,pname(名称)char(20),qty(数量)int 要求:pid设为标示列,列值从1开始,每次自动加1:产品的数量应总是正的值。下列sql语句能满足上述条件的是()。(选择一项)

A. create table product(pid int identiy(1,1),pname char(20) not null,qty int not null constraint chkqty check(qty>0))

B. create table product(pid int not null constrain defproductid default 1,pname char(20) not null,qty int not null constraint chkqty check(qty>0))

C. create table product(pid int identiy(1,1),pname char(20) not null,qty int not null constraint chkqty unique(qty>0))

D. create table product(pid int not null constrain defproductid default 1,pname char(20) not null,qty int not constraint chkqty unique(qty>0))

31.在sql server 2005中,与下列t-sql语句等效的语句为()。(选择一项) update a set a1=a1*2 where a2 in(select a2 from b where b1=2)

A. update a set a1=a1*2 inner join b on b.b1=2

B. update a set a1=a1*2 from a inner join b on b.b1=2

C. update a set a1=a1*2 where a inner join b on a.a2=b.a2 and b.b1=2

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