34,838
社区成员




create table test
(
HotelId int primary key not null,
CityId int ,
HotelName varchar(50)
constraint U_Test unique(CityId,HotelName)--生成唯一约束时,自动生成唯一索引
)
--或
create table test
(
HotelId int primary key not null,
CityId int ,
HotelName varchar(50)
)
create unique index U_test on test(CityId,HotelName)
create table test
(
HotelId int primary key not null,
CityId int unique,
HotelName varchar(50) unique
)