The WITH
clause provides a way to write supplemental statements for a larger query. These statements, also known as Common Table Expressions or CTEs, can be viewed as defining temporary tables that exist just for one query.
WITH
clause must be defined before it’s used in the query.
Here is the basic syntax of a SELECT
statement with the optional WITH
clause: