Recursive SQL Query
A Recursive SQL Query is a recursive query that is a SQL query.
References
2016
- (Wikipedia, 2016) ⇒ http://wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL Retrieved:2016-4-7.
- A hierarchical query is a type of SQL query that handles hierarchical model data. They are special case of more general recursive fixpoint queries, which compute transitive closures.
In standard SQL:1999 hierarchical queries are implemented by way of recursive common table expressions (CTEs). Unlike the Oracle extension described below, the recursive CTEs were designed with fixpoint semantics from the beginning. The recursive CTEs from the standard were relatively close to the existing implementation in IBM DB2 version 2. Recursive CTEs are also supported by Microsoft SQL Server, Firebird 2.1, PostgreSQL 8.4+, SQLite 3.8.3+, Oracle 11g Release 2, IBM Informix version 11.50+ and CUBRID. An alternative syntax is the non-standard
CONNECT BY
construct; it was introduced by Oracle in the 1980s. Prior to Oracle 10g, the construct was only useful for traversing acyclic graphs because it returned an error on detecting any cycles; in version 10g Oracle introduced the NOCYCLE feature (and keyword), making the traversal work in the presence of cycles as well. Without Common-table-expressions or a connected-by clause it is possible to achieve hierarchical queries with user-defined recursive functions. [1]
- A hierarchical query is a type of SQL query that handles hierarchical model data. They are special case of more general recursive fixpoint queries, which compute transitive closures.
- ↑ Paragon corporation: Using PostgreSQL User-Defined Functions to solve the Tree Problem, February 15, 2004, accessed September 19, 2015