码迷,mamicode.com
首页 > 数据库 > 详细

SQL

时间:2015-04-14 19:36:58      阅读:170      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!