SQL-(4) 约束
来源:互联网 发布:coc亡灵升级数据 编辑:程序博客网 时间:2024/05/22 00:35
drop table testcreate table test (testId int primary key identity(1,1), -- 主键, 也可有复合主键testname varchar(30) unique, -- 唯一, 不允许重复,但最多只有一个空值testpass varchar(30) not null, -- 不为空,插入时不能为空testage int,deptno int foreign key references dept(deptno)-- 外键约束)-----------------------------------------------------------drop table testcreate table test (testId int,testname varchar(30) unique, testpass varchar(30) not null, testage int,primary key (testId, testname) -- 复合主键)-----------------------------------------------------------drop table testcreate table test (testId int primary key identity(1,1), testname varchar(30) unique, testpass varchar(30) not null, testage int check(testage>=1 and testage<=200),-- check 限制age的范围只能是0~200之间info ntext default '请加入自我介绍'-- default 默认值)insert into test(testname, testpass, testage) values( 'jiaozl', 'jiaozl',100)select * from test
0 0
- SQL-(4) 约束
- sql约束
- SQL 约束
- SQL约束
- SQL 约束
- sql 约束
- sql约束
- SQL约束
- SQL-约束
- SQL约束
- SQL约束
- SQL 约束
- sql约束
- sql约束
- SQL 约束
- SQL 约束
- SQL 约束
- SQL 复习笔记4完整性约束
- Android使用百度自动更新遇到的奇葩问题
- 子类与父类的初始化
- 一个很好的标注工具sketch
- spring cloud config统一配置中心
- Android notifyDatasetChanged失效
- SQL-(4) 约束
- 动态批量删除
- Mat 矩阵的叉乘与点乘
- C语言算法—生成数集的所有子集(类似建立树的回溯法)
- UVa_Maximum Product
- Java对象序列化
- 实例讲解C++中CopyFileEx函数的简单用法
- VRTK插件详解二:交互之事件与委托分析
- Java问题异常