What CTEs are and how you use them
Common Table Expressions (or CTEs as they are known) in SQL are temporary, named result sets containing intermediate data that are derived from another SQL query. Once you have data in a CTE, you can reference that data one or more times within the same query.