题解 | #用where过滤空值练习#

用where过滤空值练习

https://www.nowcoder.com/practice/08c9846a423540319eea4be44e339e35

select device_id,gender,age,university
from user_profile 
where age is not null and age <> ""

这个题实际的考察点,就是空值的过滤,题目本意是想考察 null的使用。

在实际工作中,空字符串也会导致空值,所以在常规操作中

 is not null and 列 <> "" 基本同时出现
全部评论
感觉该用 OR 诶
2 回复 分享
发布于 2023-09-26 17:42 上海
<>""会同时排除null和空,用了<>""就不需要再用is not null
点赞 回复 分享
发布于 2024-10-30 15:26 广东
<> 和 != 是等价的不大佬
点赞 回复 分享
发布于 2023-10-07 22:58 浙江
你这个贴合实际
点赞 回复 分享
发布于 2023-07-11 14:17 河北

相关推荐

评论
211
9
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务