首页 > 数据库技术 > 详细

SQL

时间:2015-04-14 19:36:43      阅读:265      评论:0      收藏:0      [点我收藏+]

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)

SQL

原文:http://www.cnblogs.com/fantasy12436109/p/4425780.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!