Monday, October 27, 2014

MySQL WHERE vs. HAVING

With a SELECT ... FROM ... WHERE ... GROUP BY ... HAVING ... query, MySQL first selects rows from the table(s) by evaluating the WHERE conditions. These rows are then grouped by GROUP BY clause and further filtered by the HAVING clause.

Conditions in WHERE clause are applied for SELECT, before any GROUP BY operations.

HAVING conditions, on the other hand, are applied for GROUP BY operations, after SELECT is completed, therefore can have aggregate functions to be evaluated in the conditions.


Branched!

I have been blogging on Kavoir for 7 years or even more I don't remember. After hundreds of posts I decided I should probably start anew somewhere else. It's always exciting to start something new. It should be a habit of any entrepreneur to try new things.

This does not mean I abandoned Kavoir. On the contrary, Kavoir will continue to thrive as the main base but this place, Stargator.BlogSpot.com will serve as a outer post of mine, exploring the frontier.

Now that I'm here, expect me posting weird but useful bits and pieces about my journeys in an enterprising lifestyle.

Thanks for listening! Dismissed!