mysql查询处理顺序

参考:《MYSQL技术内幕SQL编程》

select distinct <selectlist>

from lefttable

<join-type>join <righttable>

on <join_condition>

where<where_condition>

group by<groupbylist>

with{CUBE|ROLLUP}

HAVING<havingcondition>

order by<orderbylist>

limit<limitnumber>

处理顺序

 

  1. from
  2. on
  3. join
  4. where
  5. group by
  6. cube|rollup
  7. having
  8. select
  9. distinct
  10. order by
  11. limit

你可能感兴趣的:(mysql)