教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 基础教育 >

sql数据库基础面试题复习题考试题-全(3)

来源:网络收集 时间:2026-08-15
导读: D、 如果表中不包含id 为20和id 为30的记录,则更新一行记录 7、 在SQL Server 中创建一个名为Customers的新表,同时要求该表与clients表的表结构相同,但不包括clients表的记录,sql语句是( )。 (选择一项) E

D、 如果表中不包含id 为20和id 为30的记录,则更新一行记录

7、 在SQL Server 中创建一个名为Customers的新表,同时要求该表与clients表的表结构相同,但不包括clients表的记录,sql语句是( )。 (选择一项)

E、 Select * into customers from clients where false F、 Select * into customers from clients where 1<>1 G、 Insert into customers select * from clients where false H、 Insert into customers select * from clients where 1<>1

3、在SQL Server2005数据库中,使用update语句更新数据库表中的数据,以下说法正确的是

( ) (选择一项)

A、每次只能更新一行数据 B、每次可以更新多行数据

C、如果没有数据项被更新,将提示错误信息 D、更新数据时,必须带有WHERE条件子句

4、在SQLServer2005数据库中有已经建立关系的学生表和班级表(主表),现在想删除班级表,则以下说法中正确的是( )(选择一项)

A、首先应当删除班级表中的数据,然后再删除班级表 B、可以直接删除班级表

C、首先应当删除学生表中的数据,然后在删除班级表 D、首先应当先删除学生表,然后在删除班级表

5、在SQL Server2005数据库中,删除一个表结构的命令是( )(选择一项) A、DELETE TABLE B、DROP TABLE C、TRUNCATE TABLE D、ALTER TABLE

6、在SQL Server2005数据库中,有student(学生)表,包含字段:SID(学号),SNAME(姓名),Grade(成绩)。现要将所有学员的成绩加10分。下列SQL语句正确的是( )(选择一项)

A、update students set Grade=Grade+10 where SID=1 B、update*set Grade=Grade+10

C、update*from stedents set Grade=Grade+10 D、update students set Grade=Grade+10

7、在SQL Sever 2005中,有student(学生)表,其结构为:sID(学号、int型、主键),sName(姓名、varchar型),birthday(出生日期、varchar型),score(成绩、int型)。现要向学员表中插入一名学员的信息,下列SQL语句正确的是( )(选择一项) A、INSERT INTO students VALUES(1,'李刚','1999-01-01',80)

B、INSERT INTO students (sID,sName,birthday) VALUES(1,'李刚','1999-01-01',80) C、INSERT INTO students VALUES(1,李刚,1999-01-01,80)

D、INSERT INTO students (sID,sName,birthday) VALUES(NULL,'李刚','1999-01-01')

8、在SQL Server 2005中,删除表sample中的所有数据,可以使用如下( )语句。(选择一项)

A、Drop table sample B、delete from sample C、delete*from sample D、drop*from sample

9、在SQL Sever2005数据库中有已经建立关系的学生表和班级表(主表),现在想删除班级表,当前学生表数据不为空,则以下说法中正确的是( )(选择一项) A、首先应当先删除学生表,然后再删除班级表 B、可以直接删除班级表

C、应当首先清除班级表中的数据,然后再删除班级表 D、应当首先清除学生表中的数据,然后再删除班级表

10、在SQL Server2005中,假如表ABC中有A、B、C三列,均设为字符数据类型,其中A列的默认值为“VA”。如果能够正确执行语句:INSERT ABC(A,C)VALUES (‘V’,’NULL’),下列的说法正确的是( )(选择二项)

A、插入A列的值为V B、插入A列的值为VA C、插入B列的值为空值 D、插入C列的值为空值

11、在SQL Sever 2005中,有表结构如下。现要向UserInfo表中插入一名用户的信息,下列SQL语句错误的是( )(选择一项) create table UserInfo ( id int primary key identity not null, name varchar(20) not null, age int default 20 not null )

A、insert into UserInfo values(‘admin’,22) B、insert into UserInfo values(‘admin’,default) C、insert into UserInfo(name) values(‘admin’) D、insert into UserInfo values(1,’admin’,25)

12、在SQL Sever 2005中,有表结构如下。现要向UserInfo表中插入一名用户的信息,下列SQL语句错误的是( )(选择一项) create table UserInfo ( id int primary key identity not null, name varchar(20) not null, age int default 20 not null )

A、insert into UserInfo values(‘admin’,22)

B、insert into UserInfo(name,age) values(‘admin’,default) C、insert into UserInfo(age,name) values(‘admin’,20) D、insert into UserInfo values(’admin’,25)

13、在SQL Server2005数据库中,删除一个User表数据但不删除表结构且标识列还原初始值的命令是( )(选择一项) A、delete from User B、drop table User C、truncate table User D、alter table User

第四章

8、 关于Sql Server的字符串函数,以下说法不正确的是( )。(选择一项)

A、 select trim(‘ hello ’) 返回值为: hello (前后都无空格) B、 select ltrim(rtrim(‘ hello ’)) 返回值为: hello (前后都无空格) C、 select replace(‘hello’,’e’,’o’) 返回值为: hollo D、 select right(‘hello’,3) 返回值为: llo

9、 在SQLServer 2005中,查询score表中stuName字段数据。( ) (选择一项)

A、 select * from score

B、 select * from score where stuName=”” C、 select stuName from score

D、 select stuName from score student=””

10、在SQL Server 2005中,假定有studentCourse(学生选修课)表,其结构为:sID(学号),cID(课

程.编号) ,score(成绩).那么列出所有选修课程超过5门的学生学号以及选修课数目的SQL 语句的是()。(选择一项)

a) select sID,count(cID) from studentcourse where count(cID)>5

b) select sID,count(cID) from studentcourse group by sID where count(cID)>5 c) select sID,count(cID) from studentcourse group by sID having count(cID)>5 d) select sID,count(cID) from studentcourse group by cID having count(cID)>5

11、在SQL Server 2005中,现有客户代表customer(主键:客户编号cid),包含10行数据。订单表orders(外键:客户编号cid),包含6行数据。执行sql语句:select * from customers inner join orders on customers.cid=orders.cid 返回5行记录,则执行sql语句:select * from customers inner join orders on customers.cid<>orders.cid将返回( )行记录。(选择一项)

A、 11 B、 55 C、 60 D、 5

12、在SQL Server2005中,有时候需要显示的列名为中文,下列哪项代码具有此功能( )。(选择一项)

A、 select stuName=’学员姓名’ from score B、 select * ‘学员姓名’ from score C、 select stuName ‘学员姓名’ from score D、 以上都不正确

13、取当前时间转换成10位字符串正确的是( )(选择一项)

A、 select convert(getdate()) B、 select convert(char(10))

C、 select convert(char(10),getdate()) D、 以上都不正确

14、在SQL Server 2005中,查找student表中所有身份证号码CardNo的前三位为010或020

的记录,以下 …… 此处隐藏:4109字,全部文档内容请下载后查看。喜欢就下载吧 ……

sql数据库基础面试题复习题考试题-全(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/563843.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)