--查询DQL
select column
from table_name
where search_condition
group by expression
having search_condition
order by column asc / desc
1、消除重复信息(完全重复)
distinct
select distinct column from table_name;
(1) 作用于单列
select distinct column from table_name;
(2) 作用于多列
select distince column1, column2
from table_name;
(3) 统计count函数是不能统计多个字段的,下面语句不能执行
select count(
distinct name, id)
from table_name;
若要使用,请使用嵌套查询,如下:
select count(
*)
from (
select distinct name, id form table_name);
(4)
distinct 必须放在开头
转载于:https://www.cnblogs.com/ssbydk/p/query.html