A view is a persisted SELECT
query that can be called by any user with access and privileges for the underlying tables. Just the query is persisted (the recipe), not the result. You can SELECT
from it, just like you would SELECT
from a table. Depending on your RDBMS you can store additional attributes and regulate access privileges.
In some RDBMS, even write operations on views are implemented, which are forwarded to the underlying tables.
A CTE
(Common Table Expression, a.k.a. "WITH clause") is similar to a view, but only visible to the query it is attached to and not persisted. There are differences in the implementations of various RDBMS.
Unlike a subquery, a CTE can be reused on multiple query levels independently.
A temporary table is something completely different. It's an actual table with it's own data, just not persisted and lost at the end of the session (or sometimes at the end of the transaction).