go......................................................................................................................................................14
create table Department....................................................................................................................14
(........................................................................................................................................................14
department_no int primary key --系编号........................................................................................14
name nvarchar(30) not null --系名称..............................................................................................14
);.......................................................................................................................................................14
go......................................................................................................................................................14
create table Class..............................................................................................................................14
(........................................................................................................................................................14
class_no nvarchar(10) primary key --比如:计科B20072..............................................................14
class_name nvarchar(20) not null....................................................................................................14
department_no int not null --所属系...............................................................................................14
specialty nvarchar(20) not null --所属专业.....................................................................................14
grade int not null --所属年级..........................................................................................................14
levels nvarchar(5) not null --本科、专科........................................................................................15
c o n s t r a i n t P K _ d e p a r t m e n t _ n o _ i n _ C l a s s f o r e i g n k e y ( d e p a r t m e n t _ i d ) r e f e r e n c e s
Department(department_no).............................................................................................................................15
constraint CK_levels check (levels in ('本科', '专科'))....................................................................15
);.......................................................................................................................................................15
go......................................................................................................................................................15
create table Student...........................................................................................................................15
(........................................................................................................................................................15
student_no nvarchar (10) primary key.............................................................................................15
student_name nvarchar (20) not null...............................................................................................15
student_sex nvarchar (4) not null.....................................................................................................15
class_no nvarchar(10) not null.........................................................................................................15
department_no int not null...............................................................................................................15
student_tel nvarchar (12) null..........................................................................................................15
nation nvarchar(5) null.....................................................................................................................15
student_address nvarchar (80) null..................................................................................................15
enrollment_date datatime not null...................................................................................................15
constraint Ck_sex check (sex in ('男', '女')).....................................................................................15