SQL Server 2008 新建\修改表及约束命令
来源:网络收集 点击: 时间:2024-08-19【导读】:
SQL Server 2008 新建、修改表及约束命令的操作详解工具/原料more电脑、SQL SERVER方法/步骤1/8分步阅读
2/8
3/8
4/8
5/8
6/8
7/8
8/8
创建表命令:
create table表名
( (长度),
…… (长度))

修改非空约束:
alter table表名
alter column字段名类型 not null

创建主键约束:
alter table 表名
add constraint约束名 Primary key(字段名)

创建唯一约束:
alter table 表名
add constraint约束名 unique(字段名)

创建检查约束:
alter table 表名
add constraint约束名check(条件)

创建默认约束:
alter table 表名
add constraint约束名default值for字段名

创建外键约束:
alter table 表名
add constraint约束名foreign key(字段名)references外表名(字段名)

删除表:drop table 表名
删除约束:drop constraint 约束名
版权声明:
1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。
2、本站仅提供信息发布平台,不承担相关法律责任。
3、若侵犯您的版权或隐私,请联系本站管理员删除。
4、文章链接:http://www.1haoku.cn/art_1139248.html
上一篇:口罩做兔子灯笼
下一篇:如何做出好吃美味的蒸肉