sql中如何去除值为null的列

来源:百度知道 编辑:UC知道 时间:2024/07/04 11:12:08
rt

where 列名 is not null
上面是刨去列中值为NULL的行

要去除NULL值的列是没办法的。。。除非你不查这个列。。但不查你怎么知道那列有没有NULL?

你要是怕有NULL值返回可以在列前加ISNULL

SELECT A,ISNULL(B,0) FROM TABLE

用select * from table where a is not null来删除数据
然后修改这个字段,加入not null非空约束

假使为null的列名为a

select * from tab where a is not null

delete from 表 where 列名 is null

delete from 表名 where 字段名 is null