3 use cases:
- column name alias
- table name alias
- Temporary table creation using:
WITH alias_name AS (subquery_stmt)
Used for querying in subquery:
select * from abc where abc.id in (sub_query or list)
Groupby can be done on 1 column or multiple columns, Need to use aggregate functions like Max, Cnt, Avg with group by
Set variables using SET
and use them using $name
distinct can be done on one or multiple columns. in case of multiple columns, The combination unique is shown.