check.sql
来自「简单的sql语句 数据与汇总。 高手多多指点。」· SQL 代码 · 共 36 行
SQL
36 行
alter table customers
add constraint ck_age check (age>3)
go
/*
如果改为age>5,则会出错。
因为表先建立,其中有age=5的数据
或者改为:
alter table customers
add constraint ck_age check (age>=5)
go
*/
alter table customers
drop constraint ck_age
go
alter table customers
add constraint ck_age check (age>=5)
go
/*
other way
*/
alter table customers
add height tinyint not null default(60) check(height>=60)
go
/* tinyint 一个字节,所以height不能超过255 ! 哈哈*/
select height from customers
go
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?