unity3d---SQL

列的基本操作

1、添加一列
alter table 表名 add 列名 类型(长度) null
alter table student add age int null

2、更改一列类型
alter table 表名 alter column 列名 数据类型(长度)
 column:
 alter table student alter column age int
注意:这一列没有值

3、删除一列
alter table 表名 drop column 列名
alter table student drop column age

约束
1、主键约束
alter table 表名 add constraint 主键别名 primary key (主键列)
 
2、唯一键约束
alter table 表名 add constraint 唯一键别名 unique (唯一键列)
3、默认键约束
alter table 表名  add constraint 默认键别名
 default (‘默认值’) for 默认键
4、检查键约束
alter table 表名 add constraint 检查键别名
check(stuAge>=15 and stuAge<=40)

5、外键约束
alter table  表名 1 add constraint   外键别名
foreign key( 外键 ) references 表名 2( 主键 )
on delete cascade( 级联删除 )

6、删除约束
alter table  表名   drop constraint  约束别名

更多精彩请关注:http://www.gopedu.com/
谢谢关注!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值