print @xyz
程序最后输出的结果是()。(选择一项) Floor(0.3) 地板 0 Ceiling(0.3) 天花板 1
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中,可以使用全局变量()来获得最后一次插入的标识值。(选择一项)
24.sql server 2005中,在查询分析器中调用()系统存储过程可以修改数据库的名称。(选择一项)
A. sp_databases B. sp_renamedb C. sp_tables D. sp_rename A. @@datefirst B. @@identity C. @@transcount D. @@rowcount
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 selec * 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没有正确嵌套
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
B. 该批处理结束后,表内没有数据行 C. 该批处理结束后,表内有一行数据
D. 插入数据行的语句将失败,并且提示错误信息
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 D. update a set a1=a1*2 from a inner join b on a.a2=b.a2 and b.b1=2
32.在sql server2000中,声明一个最多可以存储5个字符的变量a,正确的代码是()。(选择一项)
A. declare a varchar(5) B. declare @a varchar(5) C. a varchar(5) D. @a varchar(5)
33.在sql server的安全管理过程中,以下()的概念类似于windows中的用户。(选择一项)
A. 权限 B. 登录帐户 C. 角色
D. 存储过程
34. sql server 2005中,已知执行语句:select count(score),sum(score) from score返回的结果是10和750,那么执行语句:select avg(score) from score,返回的结果是()。(选择一项)
A. 10
B. 75
C. 750
D. 7500
35.在sql server2005中,与以下t-sql等效的是()。(选择一项)
update titless set price=price*1.05 where pub_id in (select pub_id from publishers)
A. update titles set price=price*1.05 where exists(select pub_id from publishers)
B. update titles set price=price*1.05 from titles where pub_id in C. update titles set price=price*1.05 where titles.pub_id=publishers.pub_id publishers.pub_id
D. update titles set price=price*1.05 form titles inner join publishers on titles.pub_id= publishers.pub_id
36.在sql server2000中给定如下的t-sql代码,以下说法正确的是()。(选择一项)
create procedure price_proc
(@count int output,@avg_price money output,@type char(12)='business') as
select @count=count(*),@avg_price=avg(price) from titles where type=@type
A. 建立一个存储过程price_proc,所有参数都是输出参数
B. 建立一个存储过程price_proc,返回的是用户指定图书种类的数量及平均价格 C. @count=count(*)也可以用@count=count()代替
D. 创建存储过程失败,因为select语句中使用了聚合函数,因此必须使用group by
进行分组
37.现有表名称为score,有一个名称为teacher的用户名。要求授予表的插入和修改的权限,正确的授权语句是( )。(选择一项)
A. grant insert,update to table score on teacher B. grant insert and update to table score on teacher C. grant insert,update on score to teacher
D. grant insert and update on score to teacher
38.已知有student表,studentid为主键,现在表中共有10行记录,studentid列值从1 到10。 创建视图: create view dbo.view_student as select * from dbo.student 接着执行如下命令: delete from view_student where (studentid = 8); 然后执行查询命令: