sql约束 sql创建索引

mac2022-06-30  21

1、alter table testTB add constraint U_check check(birthday<=getdate())

这句话就约束了出生日期必须小于等于今天,也可以在建表的时候写在最后为 check(birthday<=getdate())

2、创建索引

1 create unique index idx_id_birthday 2 on testTB(ID,birthday)

 

转载于:https://www.cnblogs.com/yjShow/archive/2012/12/19/2825138.html

最新回复(0)