返回数说广场 #日有所学#
1
PG中,一张表的定义如下:create table t (sn integer primary key,id integer,check(sn>0 and id<0)); 下面哪些插入语句会出现约束错误:
A、insert into t values(null,-3);
B、insert into t values(2,-1);
C、insert into t values(1,0);
D、insert into t values(3,null);
AC, 主键非空约束也算约束,(null,-3) 由于主键非空约束肯定不能插入,(1,0)不符合 check 约束也不能插入,(2,-1) 符合 check 约束条件能够插入成功,然后再看解析就明确了。
1
1 358
分享
评论
热门数说


