use SchoolDB
Go
-- 创建学生表
Create Table Student(
StuID varchar(10) primary key,
StuName nvarchar(50) not null,
StuEnName varchar(50) not null unique,
StuAge int,
StuBirthday datetime,
StuSex nvarchar(10) default('男')
)
--教师表
Create Table Teacher(
TeaID varchar(10) primary key,
TeaName nvarchar(50) not null,
TeaEnName varchar(50) not null unique,
TeaAge int,
TeaBirthday datetime,
TeaSex nvarchar(10) default('男')
)
--课程表
Create Table Course(
CouID varchar(10) primary key,
CouName nvarchar(50) not null unique,
TeaID varchar(10) foreign key(TeaID) references Teacher(TeaID)
)
--成绩表
Create Table Score(
StuID varchar(10) foreign key(StuID) references Student(StuID),
CouID varchar(10) foreign key(CouID) references Course(CouID),
Score Decimal(18,1),
)