insert into tab values(1,'JACK','0001','2000')
insert into tab values(2,'TOM','0002','')
insert into tab values(3,'LUCY','0003','3000')
insert into tab values(4,'JAME','0004','')
insert into tab values(4,'KIM','0005',null)
db2 =>select * from tab
select * from tab
ID NAME EMPID SALARY
----------- -------------------------------------------------- ---------- ---------------
1 JACK 0001 2000
2 TOM0002
3 LUCY 0003 3000
4 JAME 0004
4 KIM0005 -
5 record(s) selected.
db2 =>select * from tab where salary not in ('2000','3000')
select * from tab where salary not in ('2000','3000')
ID NAME EMPID SALARY
----------- -------------------------------------------------- ---------- ---------------
2 TOM0002
4 JAME 0004
2 record(s) selected.
db2 =>select * from tab where salary is null
select * from tab where salary is null
ID NAME EMPID SALARY
----------- -------------------------------------------------- ---------- ---------------
4 KIM0005 -
1 record(s) selected
应该你程序有问题,你试试插入此表的时候,设定不为空的字段留下一个不插入试试,那肯定会报错。
估计是你插入的是空字符串
'
'
表4个字段a
b
c
d
都是不为空的
你sql语句这样写
insert
into
table_name(a,b,c)
values(‘1’,‘1’,‘1’)这样肯定会出错
,因为d不为空
也许你插入的是这样的句子insert
into
table_name
values(‘1’,‘1’,‘1’,‘’)所以没报错
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)