Professional Documents
Culture Documents
Order of Excution
Order of Excution
Order of Excution
1. FROM clause:
- This is where the tables involved in the query are specified.
2. JOIN clause:
- If there are multiple tables in the FROM clause and they are joined, the join
conditions
are applied in this phase.
3. WHERE clause:
- The WHERE clause filters rows based on specified conditions.
4. GROUP BY clause:
- If a GROUP BY clause is present, the rows are grouped based on the specified
columns.
5. HAVING clause:
- If a HAVING clause is present, it filters groups based on specified
conditions.
6. SELECT clause:
- The SELECT clause determines which columns are included in the result set.
7. DISTINCT:
- If the DISTINCT keyword is used, duplicate rows are eliminated.
8. ORDER BY clause:
- The ORDER BY clause is applied to sort the result set based on specified
columns.
9. LIMIT/OFFSET or FETCH/FIRST:
- If there is a LIMIT/OFFSET or FETCH/FIRST clause, it limits the number of rows
returned or
specifies the starting point.