SQL

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)

posted @ 2015-04-14 18:53  fantasy12436109  阅读(139)  评论(0编辑  收藏  举报