MySQL provides with the following clauses that can be used in the SELECT statements:
- Where: The WHERE clause is a filter that defines the conditions each row in the source tables must meet to qualify for the SELECT. Only rows that meet the conditions contribute data to the result set. Data from rows that do not meet the conditions is not used.
- Group By: SQL GROUP BY statement is used to arrange identical data into groups. The GROUP BY statement is used with the SQL SELECT statement. The GROUP BY statement follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause. The GROUP BY statement is used with aggregation function.
- Having: HAVING clause is used to specify a search condition for a group or an aggregate.Having is used in a GROUP BY clause. If you are not using GROUP BY clause then you can use HAVING function like a WHERE clause.
- Order By: The ORDER BY clause sorts the result-set in ascending or descending order. It sorts the records in ascending order by default. DESC keyword is used to sort the records in descending order.