mysql query keywords where, on, having differences

In mysql, there are three conditions with the use of keywords, respectively, where, on, having, on the three keywords and efficiency is a great difference:

 

where:

  Use the keyword we use is the best start where, where the function is defined query tables (including temporary tables) line records.

 

on:

  Even when used on keyword query table that defines the connection condition table join query, the query result is on a temporary table, where if used while connecting the SQL query, where the condition for determining rows query on the temporary table the recording conditions. It is clear on the conditions priority of execution used properly, will be on efficiency than some where, because on a temporary table is generated directly from the condition.

 

having:

  After the condition for having the packet filtering, packet filtering results.

  

 

Guess you like

Origin www.cnblogs.com/limaomao/p/11088790.html