1.sql语句
select distinct <select_list>
from
left_table <join_type> join right_table
on <join_condition>
where <where_condition>
group by <group_by_list>
having <having_condition>
order by <order_by_conddition>
limit <limit_num>
2.mysql服务器处理后的顺序
from left_table
on join_condition
join_type join right_table
where where_condition
group by group_by_list
having having_condition
select
distinct select_list
order by order_by_condition
limit limit_num
顺序:先确定要查询的表,
然后where条件过滤数据,
group by进行分组,
having条件过滤每个组中的数据,
确定要查询的字段,
对于查出来信息进行排序
限制查询数据的量。