7.8. WITH Queries (Common Table Expressions)

7.8. WITH Queries (Common Table Expressions)

7.8.WITH查询(通用表表达式)

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提供了一种编写用于较大查询的辅助语句的方法。这些语句(通常称为通用表表达式或CTE)可以被认为是定义了一个仅用于一次查询的临时表。WITH子句中的辅助语句可以是SELECT,INSERT,UPDATE或DELETE;并且WITH子句本身附加到主语句,该主语句也可以是SELECT,INSERT,UPDATE或DELETE。

发布了341 篇原创文章 · 获赞 54 · 访问量 88万+

猜你喜欢

转载自blog.csdn.net/ghostliming/article/details/104552559