当前位置:文档之家› 数据库期末考试A卷答案

数据库期末考试A卷答案

数据库期末考试A卷答案
数据库期末考试A卷答案

A卷答案

一、单选题(每题2分,共40分)

1. A

2. C

3.A

4. A

5. A

6.B

7.B

8.A

9.D 10.C

11.C 12.D 13.A 14.B 15.C 16.C 17.C 18.A 19.C 20.A

二、判断题(每题2分,共20分,对的填“T”,错的填“F”)

1. N

2.N

3.N

4.N

5.Y

6.Y

7. N

8.N

9.Y 10.Y

三、设计题(共40)

1、create database [教师数据库]

use [教师数据库]

go

create table 教师表

([编号] char(6) primary key,

[姓名] nchar(4) not null,

[性别] nchar(1) check([性别] in ('男', '女')),

[民族] nchar(8) default '汉族' not null,

[职称] nchar(12),

[身份证号] char(18) unique

)

create table 课程表

([课号] char(6) primary key,

[名称] char(40) not null

)

create table 任课表

(ID IDENTITY(1, 1),

[教师编号] char(6) references 学生表(学号),

[课号] char(6) references 课程表(课号),

[课时数] integer check([课时数] between 0 and 200)

)

2. insert 课程表 values('100001', 'SQL Server数据库')

update 课程表 set 名称='Visual Basic程序设计' where 课号='100003'

delete 课程表 where 课号='100003'

3. select 课程名称, 课时数, 教师姓名=姓名 from 任课表视图

where 课程名='SQL Server数据库'

4. create procedure [统计课时数]

@课程名称nchar(16),

as

select 最大课时数=max(课时) ,最小课时数=min(课时),平均课时数=avg(课时)

from 任课表

where课程名称=@课程名称

group by 课程号

go

execute [统计课时]'SQL Server数据库'

5.select 编号, 姓名 from 教师表

where编号 in (select distinct 教师编号 from 任课表 where课时数>=70)

相关主题
文本预览
相关文档 最新文档