请问
1,在现有表中为某个字段创建唯一的非聚集索引的约束
2.为表建立一个外键,参考另一张表的某一列
use tempdb
create table t1(
c1 int,c2 int
)
alter table t1 add constraint u_c unique(C1)
create unique index u_i on t1(C2)
---下面是外键
create table t2(
c1 int foreign key references t1(c1)
)
create table t3(
c2 int foreign key references t1(c2)
)
本文介绍了如何在SQL中为指定字段创建唯一非聚集索引约束,并演示了如何设置外键约束来引用其他表的列。通过具体示例,展示了使用SQL语句实现这些功能的方法。
1345

被折叠的 条评论
为什么被折叠?



