【分类】:查询条件、 <> 'null'、!= 'null'、is not null

分析思路

select 查询结果 [设备ID,性别,年龄,学校]
from 从哪张表中查找数据 [user_profile]
where 查询条件 [年龄值不为空]

求解代码

方法一

使用 is not null

select 
    device_id,
    gender,
    age,
    university
from user_profile
where age is not null

方法二

使用 !=

select 
    device_id,
    gender,
    age,
    university
from user_profile
where age != 'null'

方法三

使用 <>

select 
    device_id,
    gender,
    age,
    university
from user_profile
where age <> 'null'