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

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

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

 is not null and 列 <> "" 基本同时出现