WITH
doesn't create a temporary table. It allows you assign names to subqueries and then reference them in your actual query as if they were tables or views. It allows you to do stepwise-refinement on a query in a way that would otherwise require either a series of defined table variables/temp tables, or a horrific tangle of nested subqueries.
One way to think of it is as a way of pre-defining your subqueries and then referencing them by name rather than putting the query expression in your final query.
SELECT INTO
, on the other hand, just creates a table based on the results of the SELECT
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.