What is a CTE and why use one?
Model answer
A common table expression is a named temporary result defined with WITH and used in the main query: WITH recent AS (SELECT ...) SELECT * FROM recent. CTEs make long queries readable, can be referenced several times, and support recursion.
Learn this topic
Subqueries, EXISTS and CTEs: Queries Inside Queries in the course SQL for Beginners: Learn Databases Step by Step.
Sign in to add your own answer.