Common table expressions (CTE) allow for the creation of temporary tables that exist only within a single SELECT, INSERT, UPDATE, DELETE or CREATE VIEW statement. CTEs can be used to simplify complex queries by breaking them into multiple logical blocks and are useful when multiple levels of aggregation are required. Recursive CTEs allow querying hierarchical data by using an initial subquery and a recursive subquery to iteratively build the results.