表A列C的值为 0 1 null
1. 查询A 等于1, select * from A where C = 1
2. 查询A 等于0 与nul, select * from A where C = 0 and C is null
注意: 不能直接使用select * from A where C <> 1
null <> 1 这个不为真!
本文介绍了在SQL中如何针对包含NULL值的列进行精确查询的方法,包括如何查询特定值及NULL值,同时指出了常见的查询误区。
表A列C的值为 0 1 null
1. 查询A 等于1, select * from A where C = 1
2. 查询A 等于0 与nul, select * from A where C = 0 and C is null
注意: 不能直接使用select * from A where C <> 1
null <> 1 这个不为真!
6208

被折叠的 条评论
为什么被折叠?