1. SQL Server 2000是典型的关系型数据库产品。 ( 1 )
2. 在一台计算机上可以同时运行多个版本的SQL Server。 ( 1 )
3. 在SQL Server中日志文件是维护数据库完整性的重要工具。 ( 0 )
4. 在定义数据表时,定义某列为标识列的关键字是Identity。 ( 1 )
5. 浮点数据类型的优点是能够存储范围非常大的数字,但容易发生误差。 ( 0 )
6. 数据库完整性的目的是为了防止错误信息输入和输出。 ( 0 )
7. 在Update语句中,一次可以更新多个表。 ( 0)
8. 尽量使用Select * ,可以加快查询速度。 ( 0 )
9. 在SQL Server 2000中表示注释可以用类似C语言的/*...*/和//。 ( 0 )
10. 在SQL Server中,RTRIM函数删除字符串右边的空白字符。 ( 1 )
11. 一个表只能有一个聚集索引(簇索引)。 ( 1 )
12. SQL查询语言中,如果没有指定排序方式,则默认是升序方式。 ( 1 )
13. 在SQL Server 2000中ntext类型的字段不能进行排序操作。 ( 0 )
14. 在SQL Server 2000中bit类型的字段不能建立索引。 ( 1 )
15. 在被定义为唯一索引的列上的数据不能有重复的值。 ( 1 )
16. 在被定义为唯一索引的列上的数据不允许空。 ( 0可以的但是只能有一个null值 )
17. 在SQL Server中,每张表都应该建立一个索引,以提高查询速度。 ( 0 )
18. 视图在SQL Server中是一张虚拟表。 ( 1 )
19. 当一个视图由2个以上基本表构成时,不能进行删除视图中的数据。 ( 0 )
20. 在SQL Server中,触发器是一种特殊的存储过程。 ( 1 )
21. 由于存储过程是解释执行,所以每次执行时都要检查是否有语法错误。 ( 0 )
22. 可以在用户正在使用的数据库上执行数据库恢复操作。 ( 0 )
1表示正确
② 简单的SQL语句练习,最好给出解释
1D 2B 3A 初步答案,你试试
③ SQL数据库练习题~
1.select name from 学生
where 系别='数学系' and 性别='女';
2.select a.name from 学生 a inner join 选课 b
on a.学号=b.学号
where 成绩<60;
3.select a.name from 学生 a inner join 选课 b
on a.学号=b.学号
where avg(成绩)>=95;
4.select a.name from 学生 a inner join 选课 b
on a.学号=b.学号
where (select b.成绩 from 课程 c inner join 选课 b
on c.课程号=b.课程号 where 课程名='SQL Server 2000')<60
5.update 学生
set 年龄=年龄+1;
④ SQL语句 习题拜托大家啦!!
A,B,C,C(关系模型数据库结构应该是二维表,无正确选项选项错误),A,B,C,D,D,D,A,B,A.
给分噢。保你100分。只是你第四道题,没有答案。
⑤ 关于SQL命令的练习题,急急急!!!
select * from 专业表
select * from 课程表 where ID='000001' order by 成绩 desc
select avg(成绩) from 成绩表 group by 课程 where 人数>1
select count(人数),max(成绩),min(成绩),avg(成绩) from 成绩表 group by 课程 where 成绩 is not null
select count(课程) from 成绩表 group by 学号
sleect * from 学生信息表 join 成绩表 on 学号=学号
⑥ SQL数据查询练习
--1.1创建新表 score
create table score
(
[学号] varchar(10)
,[课程号] varchar(10)
,[成绩] float
)
--1.2插入新表的值
insert into score values(103,'3-245',86)
insert into score values(105,'3-245',75)
insert into score values(109,'3-245',68)
insert into score values(103,'3-105',92)
insert into score values(105,'3-105',88)
insert into score values(109,'3-105',76)
insert into score values(101,'3-105',64)
insert into score values(101,'3-105',64)
insert into score values(101,'6-166',85)
insert into score values(107,'6-166',79)
insert into score values(108,'6-166',81)
--1.3 按排列顺序查看创建的表的内容
select* from score order by [课程号] asc,[成绩] desc --这样查看不舒服,可以修改下,如下面这句:
select [课程号],[成绩],[学号] from score order by [课程号] asc,[成绩] desc
--1.4
select y=sum([成绩]) --查找3-105 的分数之和,问题6-166的总分也是这个道理
, x=count([课程号]) from score where [课程号]='3-105'--查找3-105的课程个数
--计算平均分
select [3-105平均分]=y/x from(select y=sum([成绩])
, x=count([课程号]) from score where [课程号]='3-105')t
--1.5 查询成绩为定值的记录
select * from score where [成绩]='85' or [成绩]='86' or [成绩]='88'
--这里用and 的话没法查出内容,
--1.6 成绩在多少到多少的记录
select * from score where [成绩] between 60 and 79 order by [成绩] desc
--1.7查询每个学生的最高分
select * from score where [成绩] in(select max([成绩]) from score group by [学号])
--1.8课程最高分
select * from score where [成绩] in(select max([成绩]) from score group by [课程号])
--各门课程最高分大于90的就是在上面的内容上增加一个where 条件,自己尝试下
select * from(select * from score where [成绩] in(select max([成绩]) from score group by [课程号]))t
where [成绩]>=90
--注意数据库别名的用法't'
--1.9弟九个问题跳过,扯蛋的问题
--2.0课程次数及排序
select [课程号],[课程次数]=count([课程号]) from score group by [课程号] order by 课程次数 desc
--注意数据库自定义字段的使用
--升序 asc ,降序 desc
--2.1最后一个问题你自己考虑考虑,方法基本都在前面几个问题里面可以找到。
⑦ SQL的练习,求答案!!!
/*创建Moonfox_db数据库*/
use master
if exists(select * from sysdatabases where name='Moonfox_db')
drop database Moonfox_db
create database Moonfox_db
on
(
name='Moonfox_db_data',
filename='D:\Visual Studio 2008 & Sql server 2005\Sql server\Moonfox_db.mdf',
size=10,
filegrowth=2MB
)
log on
(
name='Moonfox_db_log',
filename='D:\Visual Studio 2008 & Sql server 2005\Sql server\Moonfox_db.ldf',
size=5,
filegrowth=20%
)/*创建Department表*/
use Moonfox_db
if exists(select * from sysobjects where name='Department')
drop table Department
create table Department
(
DID int identity (1,1)primary key,--部门编号,主键
Dname nvarchar(20),--部门名称
Address nvarchar(50),--部门地址
Photo decimal(12,0),--电话
)/*创建Employee表*/
use Moonfox_db
if exists(select * from sysobjects where name='Employee')
drop table Employee
create table Employee
(
EID int identity (1,1)primary key,--职工编号,主键
Ename varchar(10),--职工名
Gender nchar(2) check(Gender='男' or Gender='女'),--性别,添加限制
Position nvarchar(10) check(Position='员工' or Position='组长' or Position='经理'),--职务,添加限制
Address nvarchar(50),--家庭地址
DID int,--部门编号,外键
foreign key(DID) references Department(DID)--外键约束
)
/*创建Care表*/
use Moonfox_db
if exists(select * from sysobjects where name='Care')
drop table Care
create table Care
(
CID int identity (1,1)primary key,--保健卡编号,主键
EID int,--职工号,外键
foreign key(EID) references Employee(EID),--外键约束
CheckDate datetime,--检查身体日期
PhysicalCondition nvarchar(4) check(PhysicalCondition='一般' or PhysicalCondition='差' or PhysicalCondition='好'),--健康状况
)
/*创建Care表约束*/
alter table Care
add
constraint DF_CheckDate default(getdate()) for CheckDate--缺省,默认净时间为当前计算机时间 路径自己修改,试图自己做,选择语句自己写。我该睡觉了,抱歉,你试着在sql server中运行下,我等着休息,也不知道写的有没有错误,没时间帮你写省下的了。不急着用的话我明天帮你写吧。
⑧ sql练习!!!
alter talbe stuscore
add constraint ch_a check(english<100 and english>0)
select * from stuinfo where name like '张%' and sex = '男'
select time from stuinfo where name = '刘k'
……………………
……………………
只能到这里了,仅供参考