过滤数据
distinct关键字 去除重复的数据 直接加在select即可
select distinct (name/*)
from sales.customers
order by name
当出现很多null值只会保留一个,当然对于null去重有其他更多的方法。
当不使用distinct时:

当使用distinct去重时,就只会出现一次Null:

where语句
作用于筛选,例如:
查询sales.customers表电话不为空的用户信息
select *
from sales.customers
where phone is not null

或者查询电话为空的用户信息:

又或者筛选某个详细的条目,例如:
查询sales.customers表中电话为(619) 635-2027的用户信息
select *
from sales.customers
6758



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



