6.对唯一键的操作

use studb

-- 创建表student,设置ssno为主键,ssfzh为唯一键
go
create table student(
	ssno varchar(6) primary key,
	sname varchar(8),
	ssfzh varchar(18) constraint  unique_ unique
	)
go

-- 为表student,设置字段ssfzh为唯一键
go
alter table student
add
constraint sssfza unique(ssfzh)
go

-- 删除表student,ssfzh的唯一键设置
go
alter table student
drop
constraint sssfza
go

猜你喜欢

转载自blog.csdn.net/qq_53183608/article/details/121704876