7.8. WITH Queries (Common Table Expressions)

7.8. WITH Queries (Common Table Expressions)

7.8.WITH query (common table expression)

WITH provides a way to write auxiliary statements for use in a larger query. These statements, which are often referred to as Common Table Expressions or CTEs, can be thought of as defining temporary tables that exist just for one query. Each auxiliary statement in a WITH clause can be a SELECT,INSERT, UPDATE, or DELETE; and the WITH clause itself is attached to a primary statement that can also be a SELECT, INSERT, UPDATE, or DELETE.

WITH provides a method for the preparation of the statement assist larger query. These statements (often referred to as common table expression or CTE) can be considered as a temporary table is defined only once for a query. WITH clause auxiliary statement can be SELECT, INSERT, UPDATE, or the DELETE; WITH clause itself and attached to the main statement, the statement may be the main SELECT, INSERT, UPDATE or DELETE.

Published 341 original articles · won praise 54 · views 880 000 +

Guess you like

Origin blog.csdn.net/ghostliming/article/details/104552559