create database db1
go
use db1
go
create table student
( Sno char(8),
Sname char(20),
Sage int,
Sdept char(40),
Ssex char(2),
primary key(Sno)
)
go
create table course
( Cno char(4) primary key,
Cname char(20),
Cpno char(4),
Ccredit smallint ,
foreign key(Cpno) references course(Cno)
)
go
create table sc (
Sno char(8),
Cno char(4) ,
Grade smallint ,
primary key(Sno,Cno),
foreign key(Sno) references course(Sno),
foreign key(Cno) references course(Cno) )
go
alter table student add sbirthday datetime
go
alter table student drop column Sage
go
create unique index Sno on (student)