-- 删除表
drop table check_test;
-- 不为空,不为null的值只能是0,1(不为空,值只能是0,1)
create table check_test(
default_flag number(1) not null
-- 检查约束
check (default_flag in(0,1))
); -- 可以为null,不为null的值只能是0,1(null,0,1)
create table check_test(
default_flag number(1)
-- 检查约束
check (default_flag in(0,1))
); -- 测试
insert into check_test(default_flag) values(0); insert into check_test(default_flag) values(1); insert into check_test(default_flag) values(2); insert into check_test(default_flag) values(3); insert into check_test(default_flag) values(null); select * from check_test;
相关文章
- 主键约束(PRIMARY KEY) [MySQL][数据库]
- 外键约束(foreign key) [MySQL][数据库]
- 唯一性约束 [MySQL][数据库]
- MySQL——ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds……
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- [42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL
- Eclipse中配置约束
- postman Installation has failed: There was an error while installing the application. Check the setu...
- Android项目打包遇com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details