What is a common table expression (CTE) in SQL?
A Common Table Expression (CTE) is a temporary result set that can be referenced within
a SELECT, INSERT, UPDATE, or DELETE statement. CTEs are often used for organizing
complex queries.
Example:
WITH EmployeeCTE AS (
SELECT name, salary
FROM employees
WHERE salary > 50000
SELECT * FROM EmployeeCTE;