/*
*/
/*
*/
create table users(id int not null identity(1,1) primary key,uname char(10),upasswd char(12))
go
insert into users(uname,upasswd) values('张明','123456');
insert into users(uname,upasswd) values('吴昊','234567');
insert into users(uname,upasswd) values('刘洋','345678');
EXEC sp_rename 'users.id','uid','column'
go
/*
*/
alter table student add constraint PK_student primary key(sno)
go
alter table score add constraint PK_score primary key(scno)
go
alter table score add constraint FK_student foreign key(sno) references student(sno)
go
alter table score drop constraint FK_student
go
/*
*/
create table uinfo(uiid int not null,uid int not null,qq char(15),answerType int,answer text,email varchar(25),primary key(uiid),foreign key(uid) references users(uid))
go
alter table student add constraint CK_student check(age between 19 and 25)
go
alter table student drop constraint CK_student
go
/*
*/
常用语句(三)alert table ... 、constraint、foreign key(...) references ...(...)、check(... between ...)
最新推荐文章于 2021-10-02 10:41:18 发布