SQL server 创建表,索引,主键,外键

if object_id('student', 'U') is not null
drop table student
go create table student(
sno varchar(20) not null ,
sage decimal not null,
sname varchar(20)
)
go create nonclustered index stu_index on student(sno)
go if(object_id('person', 'U') is not null)
drop table person
go create table person(
sname varchar(20) not null
)
go alter table person add primary key(sname)
go create nonclustered index person_index on person(sname)
go alter table student add primary key(sno, sage)
go alter table student add foreign key(sname) references person(sname)
go
上一篇:Windows Azure Web Site (9) Web Site公网IP地址


下一篇:一个demo让你彻底理解Android中触摸事件的分发