Temporary Table
A temporary table holds data only for the duration of a session or transaction, then is automatically dropped or emptied — used to stage intermediate results in a multi-step process without permanently altering the schema.
Unlike a CTE (which exists only for one statement) or a derived table (inline, unnamed), a temporary table persists across multiple statements within a session and can have its own indexes and statistics — useful when an intermediate result set is large and reused several times.
Syntax and scoping vary by database: SQL Server's #temp tables are session-scoped in tempdb; PostgreSQL and Oracle support CREATE TEMPORARY TABLE / CREATE GLOBAL TEMPORARY TABLE with similar session or transaction scoping.
CREATE TEMPORARY TABLE staging_orders AS
SELECT * FROM orders WHERE status = 'pending';