撒
撒旦
Unregistered / Unconfirmed
GUEST, unregistred user!
这是我在SQL Server 2000中建立的三张表,分别是Student,SC,Course
create table Student(
Sno char(7) primary key,
Sname char(10) not null,
Ssex char(2) check(Ssex = '男' or Ssex='女'),
Sage tinyint check(Sage>=15 and Sage<=45),
Sdept char(20) default'计算机系'
)
create table Course(
Cno char(10) not null,
Cname char(20) not null,
Ccredit tinyint check(Ccredit>0),
Semster tinyint check(Semster>0),
primary key(Cno)
)
create table SC(
Sno char(7) not null,
Cno char(10) not null,
Grade tinyint check(Grade>=0 and Grade<=100),
primary key(Sno,Cno),
foreign key (Sno) references Student(Sno),
foreign key (Cno) references Course(Cno)
)
create table Student(
Sno char(7) primary key,
Sname char(10) not null,
Ssex char(2) check(Ssex = '男' or Ssex='女'),
Sage tinyint check(Sage>=15 and Sage<=45),
Sdept char(20) default'计算机系'
)
create table Course(
Cno char(10) not null,
Cname char(20) not null,
Ccredit tinyint check(Ccredit>0),
Semster tinyint check(Semster>0),
primary key(Cno)
)
create table SC(
Sno char(7) not null,
Cno char(10) not null,
Grade tinyint check(Grade>=0 and Grade<=100),
primary key(Sno,Cno),
foreign key (Sno) references Student(Sno),
foreign key (Cno) references Course(Cno)
)