SQL

SELECT column_name(s)

FROM table1

INNER JOIN table2

ON table1.column_name = table2.column_name; 

A common table expression, or CTE, is a temporary named result set created from a simple SELECT statement that can be used in a subsequent SELECT statement. Each SQL CTE is like a named query, whose result is stored in a virtual table (a CTE) to be referenced later in the main query.