你的位置:首页 > 软件开发 > 数据库 > 数据库系列学习(十)

数据库系列学习(十)

发布时间:2015-08-15 22:00:09
1.主键约束(primary key)create table T_User1( Id int primary key identity(1,1), UName nvarchar(10))2.非空约束(not null)create table T_User2( Id ...
1.主键约束(primary key)
create table T_User1(    Id int primary key identity(1,1),  UName nvarchar(10))
2.非空约束(not null)create table T_User2(  Id int primary key identity(1,1),  UName nvarchar(10) not null)3.1唯一约束(unique)-单列create table T_User3(  Id int primary key identity(1,1),  UNo nvarchar(10)unique)3.2唯一约束-多列create table T_User4(  Id int primary key identity(1,1),  UAddress nvarchar(10),  UName nvarchar(10),  constraint uniq_addr_name unique(UAddress,UName))4.1Check约束(check)-单列create table T_User5(  Id int primary key identity(1,1),  UName nvarchar(10)check(len(UName)<4),  UAge int check(UAge>0))4.2Check约束-多列create table T_User6(  Id int primary key identity(1,1),  UWorkYear int,  UAge int,  constraint ck_wkyear_age check(UWorkYear<UAge))5.外键约束(foreign key)create table T_Author(  AId int primary key identity(1,1),  AName nvarchar(10))create table T_Blog(  BId int primary key identity(1,1),  BAuthorId int,  foreign key(BAuthorId) references T_Author(AId))

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:数据库系列学习(十)

关键词:数据库

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。