mysql关键字执行顺序

SQL查询中用到的关键词:select、distinct、from、join、on、where、group by、having、sum、count、max、avg、order by、limit

书写顺序:

select->distinct->from->join->on->where->group by->having->order by->limit

必须字段:select、from

可选字段:distinct、join、on、where、group by、having、sum、count、max、avg、order by、limit

执行顺序

from->on->join->where->group by(开始使用select中的别名,后面的语句中都可以使用别名)->sum、count、max、avg->having->select->distinct->order by->limit


版权声明:本文为weixin_47796247原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。