SQL语句的执行顺序:from->on->join->where->group by->having->select->distinct->union->order by->limit
【条件查询】where、and/or、between、in、is (not) null
【模糊查询】like、%、_
【查询结果排序】order by
【限制查询结果数量】limit i,k
【聚合运算】count、max、min、avg、sum,忽略空值
【分组查询】group by
【分组后筛选】having
【连接】inner join、left/right join
【合并查询】union
【自连接】
【多表连接】