Clauses of SELECT statement
Note:SELECT and FROM clauses are mandatory
Note:Order of clauses can't change
Select:
- List the columns (and expressions) that should be returned from the Query
From:
- From Clause is mandatory
- It indicates from which table data is retriving
- It represents at least one table
- In case of multiple tables, we should seperate with COMMAS(,) or use JOIN as key word
Where:
- It is optional clause
- It represents search condition, which ROW needs to include in result
Groupby:
- It is optional clause
- Columns to Group results
Having:
- It is optional clause
- It is extension of GROUPBY
- It indicates the condition under which GROUP needs to include in result
Orderby:
- It is optional clause
- Result to display based on columns
Note:
• SELECT and FROM clauses are Mandatory
• Order of clauses can’t be changed
Flow chart of SELECT statement
Order of Declaration & Order of Execution