https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Hierarchical_and_recursive_queries_in_SQL Hierarchical and recursive queries in SQL - Revision history 2025-05-30T06:51:04Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1265726824&oldid=prev WikiCleanerBot: v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation) 2024-12-28T10:03:43Z <p>v2.05b - <a href="/wiki/User:WikiCleanerBot#T20" title="User:WikiCleanerBot">Bot T20 CW#61</a> - Fix errors for <a href="/wiki/Wikipedia:WCW" class="mw-redirect" title="Wikipedia:WCW">CW project</a> (Reference before punctuation)</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 10:03, 28 December 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 14:</td> <td colspan="2" class="diff-lineno">Line 14:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>CTEs can be thought of as alternatives to derived tables ([[subquery]]), [[view (database)|views]], and inline user-defined functions.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>CTEs can be thought of as alternatives to derived tables ([[subquery]]), [[view (database)|views]], and inline user-defined functions.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Common table expressions are supported by [[Teradata]] (starting with version 14), [[IBM Db2]], [[Informix]] (starting with version 14.1), [[Firebird (database server)|Firebird]] (starting with version 2.1),&lt;ref&gt;https://firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-2.5-LangRef-Update.pdf {{Bare URL PDF|date=March 2022}}&lt;/ref&gt; [[Microsoft SQL Server]] (starting with version 2005), [[Oracle Database|Oracle]] (with recursion since 11g release 2), [[PostgreSQL]] (since 8.4), [[MariaDB]] (since 10.2&lt;ref&gt;{{Cite web |title=MariaDB 10.2.0 Changelog |url=https://mariadb.com/kb/en/mariadb-1020-changelog/ |access-date=2024-12-22 |website=MariaDB KnowledgeBase}}&lt;/ref&gt;), [[MySQL]] (since 8.0), [[SQLite]] (since 3.8.3), [[HSQLDB|HyperSQL]], [[IBM Informix|Informix]] (since 14.10)&lt;ref&gt;possible before 14.10 with temp tables https://stackoverflow.com/questions/42579298/why-does-a-with-clause-give-a-syntax-error-on-informix&lt;/ref&gt;<del style="font-weight: bold; text-decoration: none;">,</del> Google [[BigQuery]], [[Sybase (database)|Sybase]] (starting with version 9), [[Vertica]], [[H2 (DBMS)|H2]] (experimental),&lt;ref&gt;{{Cite web|url=http://www.h2database.com/html/advanced.html#recursive_queries|title = Advanced}}&lt;/ref&gt; and [[Comparison of relational database management systems|many others]]. Oracle calls CTEs "subquery factoring".&lt;ref name="MortonSands2010"&gt;{{cite book|author1=Karen Morton|author2=Robyn Sands|author3=Jared Still|author4=Riyaj Shamsudeen |author5=Kerry Osborne|title=Pro Oracle SQL|url=https://books.google.com/books?id=nrwu-f4JwjcC&amp;pg=PA283|year=2010|publisher=Apress|isbn=978-1-4302-3228-5|page=283}}&lt;/ref&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Common table expressions are supported by [[Teradata]] (starting with version 14), [[IBM Db2]], [[Informix]] (starting with version 14.1), [[Firebird (database server)|Firebird]] (starting with version 2.1),&lt;ref&gt;https://firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-2.5-LangRef-Update.pdf {{Bare URL PDF|date=March 2022}}&lt;/ref&gt; [[Microsoft SQL Server]] (starting with version 2005), [[Oracle Database|Oracle]] (with recursion since 11g release 2), [[PostgreSQL]] (since 8.4), [[MariaDB]] (since 10.2&lt;ref&gt;{{Cite web |title=MariaDB 10.2.0 Changelog |url=https://mariadb.com/kb/en/mariadb-1020-changelog/ |access-date=2024-12-22 |website=MariaDB KnowledgeBase}}&lt;/ref&gt;), [[MySQL]] (since 8.0), [[SQLite]] (since 3.8.3), [[HSQLDB|HyperSQL]], [[IBM Informix|Informix]] (since 14.10)<ins style="font-weight: bold; text-decoration: none;">,</ins>&lt;ref&gt;possible before 14.10 with temp tables https://stackoverflow.com/questions/42579298/why-does-a-with-clause-give-a-syntax-error-on-informix&lt;/ref&gt; Google [[BigQuery]], [[Sybase (database)|Sybase]] (starting with version 9), [[Vertica]], [[H2 (DBMS)|H2]] (experimental),&lt;ref&gt;{{Cite web|url=http://www.h2database.com/html/advanced.html#recursive_queries|title = Advanced}}&lt;/ref&gt; and [[Comparison of relational database management systems|many others]]. Oracle calls CTEs "subquery factoring".&lt;ref name="MortonSands2010"&gt;{{cite book|author1=Karen Morton|author2=Robyn Sands|author3=Jared Still|author4=Riyaj Shamsudeen |author5=Kerry Osborne|title=Pro Oracle SQL|url=https://books.google.com/books?id=nrwu-f4JwjcC&amp;pg=PA283|year=2010|publisher=Apress|isbn=978-1-4302-3228-5|page=283}}&lt;/ref&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The syntax for a CTE (which may or may not be recursive) is as follows:</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The syntax for a CTE (which may or may not be recursive) is as follows:</div></td> </tr> </table> WikiCleanerBot https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1264560891&oldid=prev Theking2: Add ref to MariaDB changelog 2024-12-22T11:49:41Z <p>Add ref to MariaDB changelog</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:49, 22 December 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 14:</td> <td colspan="2" class="diff-lineno">Line 14:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>CTEs can be thought of as alternatives to derived tables ([[subquery]]), [[view (database)|views]], and inline user-defined functions.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>CTEs can be thought of as alternatives to derived tables ([[subquery]]), [[view (database)|views]], and inline user-defined functions.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Common table expressions are supported by [[Teradata]] (starting with version 14), [[IBM Db2]], [[Informix]] (starting with version 14.1), [[Firebird (database server)|Firebird]] (starting with version 2.1),&lt;ref&gt;https://firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-2.5-LangRef-Update.pdf {{Bare URL PDF|date=March 2022}}&lt;/ref&gt; [[Microsoft SQL Server]] (starting with version 2005), [[Oracle Database|Oracle]] (with recursion since 11g release 2), [[PostgreSQL]] (since 8.4), [[MariaDB]] (since 10.2), [[MySQL]] (since 8.0), [[SQLite]] (since 3.8.3), [[HSQLDB|HyperSQL]], [[IBM Informix|Informix]] (since 14.10)<del style="font-weight: bold; text-decoration: none;">,</del>&lt;ref&gt;possible before 14.10 with temp tables https://stackoverflow.com/questions/42579298/why-does-a-with-clause-give-a-syntax-error-on-informix&lt;/ref&gt; Google [[BigQuery]], [[Sybase (database)|Sybase]] (starting with version 9), [[Vertica]], [[H2 (DBMS)|H2]] (experimental),&lt;ref&gt;{{Cite web|url=http://www.h2database.com/html/advanced.html#recursive_queries|title = Advanced}}&lt;/ref&gt; and [[Comparison of relational database management systems|many others]]. Oracle calls CTEs "subquery factoring".&lt;ref name="MortonSands2010"&gt;{{cite book|author1=Karen Morton|author2=Robyn Sands|author3=Jared Still|author4=Riyaj Shamsudeen |author5=Kerry Osborne|title=Pro Oracle SQL|url=https://books.google.com/books?id=nrwu-f4JwjcC&amp;pg=PA283|year=2010|publisher=Apress|isbn=978-1-4302-3228-5|page=283}}&lt;/ref&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Common table expressions are supported by [[Teradata]] (starting with version 14), [[IBM Db2]], [[Informix]] (starting with version 14.1), [[Firebird (database server)|Firebird]] (starting with version 2.1),&lt;ref&gt;https://firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-2.5-LangRef-Update.pdf {{Bare URL PDF|date=March 2022}}&lt;/ref&gt; [[Microsoft SQL Server]] (starting with version 2005), [[Oracle Database|Oracle]] (with recursion since 11g release 2), [[PostgreSQL]] (since 8.4), [[MariaDB]] (since 10.2<ins style="font-weight: bold; text-decoration: none;">&lt;ref&gt;{{Cite web |title=MariaDB 10.2.0 Changelog |url=https://mariadb.com/kb/en/mariadb-1020-changelog/ |access-date=2024-12-22 |website=MariaDB KnowledgeBase}}&lt;/ref&gt;</ins>), [[MySQL]] (since 8.0), [[SQLite]] (since 3.8.3), [[HSQLDB|HyperSQL]], [[IBM Informix|Informix]] (since 14.10)&lt;ref&gt;possible before 14.10 with temp tables https://stackoverflow.com/questions/42579298/why-does-a-with-clause-give-a-syntax-error-on-informix&lt;/ref&gt;<ins style="font-weight: bold; text-decoration: none;">,</ins> Google [[BigQuery]], [[Sybase (database)|Sybase]] (starting with version 9), [[Vertica]], [[H2 (DBMS)|H2]] (experimental),&lt;ref&gt;{{Cite web|url=http://www.h2database.com/html/advanced.html#recursive_queries|title = Advanced}}&lt;/ref&gt; and [[Comparison of relational database management systems|many others]]. Oracle calls CTEs "subquery factoring".&lt;ref name="MortonSands2010"&gt;{{cite book|author1=Karen Morton|author2=Robyn Sands|author3=Jared Still|author4=Riyaj Shamsudeen |author5=Kerry Osborne|title=Pro Oracle SQL|url=https://books.google.com/books?id=nrwu-f4JwjcC&amp;pg=PA283|year=2010|publisher=Apress|isbn=978-1-4302-3228-5|page=283}}&lt;/ref&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The syntax for a CTE (which may or may not be recursive) is as follows:</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The syntax for a CTE (which may or may not be recursive) is as follows:</div></td> </tr> </table> Theking2 https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1239102106&oldid=prev InternetArchiveBot: Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5 2024-08-07T10:45:40Z <p>Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 10:45, 7 August 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 4:</td> <td colspan="2" class="diff-lineno">Line 4:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>A '''hierarchical query''' is a type of [[Select (SQL)|SQL query]] that handles [[hierarchical model]] data. They are special cases of more general recursive [[fixpoint]] queries, which compute [[transitive closure]]s.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>A '''hierarchical query''' is a type of [[Select (SQL)|SQL query]] that handles [[hierarchical model]] data. They are special cases of more general recursive [[fixpoint]] queries, which compute [[transitive closure]]s.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>In standard [[SQL:1999]] hierarchical queries are implemented by way of recursive ''[[#Common table expression|common table expressions]]'' (CTEs). Unlike Oracle's earlier [[#CONNECT BY|connect-by clause]], recursive CTEs were designed with fixpoint semantics from the beginning.&lt;ref name="JimMelton1"&gt;{{cite book|author1=Jim Melton|author2=Alan R. Simon|title=SQL:1999: Understanding Relational Language Components|url=https://books.google.com/books?id=wyhXvU0Eyg0C&amp;pg=PA352|year=2002|publisher=Morgan Kaufmann|isbn=978-1-55860-456-8}}&lt;/ref&gt; Recursive CTEs from the standard were relatively close to the existing implementation in IBM DB2 version 2.&lt;ref name="JimMelton1"/&gt; Recursive CTEs are also supported by [[Microsoft SQL Server]] (since SQL Server 2008 R2),&lt;ref name="msdnRCTEs"&gt;{{cite web |url=http://msdn.microsoft.com/en-us/library/ms186243.aspx |title=Recursive Queries Using Common Table Expressions |author=Microsoft |access-date=2009-12-23}}&lt;/ref&gt; [[Firebird (database server)|Firebird 2.1]],&lt;ref&gt;{{cite web |url=http://firebirdsql.org/rlsnotesh/rlsnotes210.html#rnfb210-cte |title=Firebird 2.1 Release Notes |author=Helen Borrie |date=2008-07-15 |access-date=2015-11-24}}&lt;/ref&gt; [[PostgreSQL|PostgreSQL 8.4+]],&lt;ref&gt;{{cite web |url=http://www.postgresql.org/docs/current/interactive/queries-with.html |title=WITH Queries|date=10 February 2022}} PostgreSQL&lt;/ref&gt; [[SQLite|SQLite 3.8.3+]],&lt;ref&gt;{{cite web |url=http://www.sqlite.org/lang_with.html |title=WITH Clause}} SQLite&lt;/ref&gt; [[IBM Informix]] version 11.50+, [[CUBRID]], [[MariaDB|MariaDB 10.2+]] and [[MySQL|MySQL 8.0.1+]].&lt;ref&gt;{{cite web |url=https://mysqlserverteam.com/mysql-8-0-labs-recursive-common-table-expressions-in-mysql-ctes/ |title=MySQL 8.0 Labs: [Recursive] Common Table Expressions in MySQL (CTEs)}} mysqlserverteam.com&lt;/ref&gt; [https://kb.tableau.com/articles/howto/using-common-table-expressions Tableau has documentation] describing how CTEs can be used. TIBCO Spotfire does not support CTEs, while Oracle 11g Release 2's implementation lacks fixpoint semantics.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>In standard [[SQL:1999]] hierarchical queries are implemented by way of recursive ''[[#Common table expression|common table expressions]]'' (CTEs). Unlike Oracle's earlier [[#CONNECT BY|connect-by clause]], recursive CTEs were designed with fixpoint semantics from the beginning.&lt;ref name="JimMelton1"&gt;{{cite book|author1=Jim Melton|author2=Alan R. Simon|title=SQL:1999: Understanding Relational Language Components|url=https://books.google.com/books?id=wyhXvU0Eyg0C&amp;pg=PA352|year=2002|publisher=Morgan Kaufmann|isbn=978-1-55860-456-8}}&lt;/ref&gt; Recursive CTEs from the standard were relatively close to the existing implementation in IBM DB2 version 2.&lt;ref name="JimMelton1"/&gt; Recursive CTEs are also supported by [[Microsoft SQL Server]] (since SQL Server 2008 R2),&lt;ref name="msdnRCTEs"&gt;{{cite web |url=http://msdn.microsoft.com/en-us/library/ms186243.aspx |title=Recursive Queries Using Common Table Expressions |author=Microsoft |access-date=2009-12-23}}&lt;/ref&gt; [[Firebird (database server)|Firebird 2.1]],&lt;ref&gt;{{cite web |url=http://firebirdsql.org/rlsnotesh/rlsnotes210.html#rnfb210-cte |title=Firebird 2.1 Release Notes |author=Helen Borrie |date=2008-07-15 |access-date=2015-11-24}}&lt;/ref&gt; [[PostgreSQL|PostgreSQL 8.4+]],&lt;ref&gt;{{cite web |url=http://www.postgresql.org/docs/current/interactive/queries-with.html |title=WITH Queries|date=10 February 2022}} PostgreSQL&lt;/ref&gt; [[SQLite|SQLite 3.8.3+]],&lt;ref&gt;{{cite web |url=http://www.sqlite.org/lang_with.html |title=WITH Clause}} SQLite&lt;/ref&gt; [[IBM Informix]] version 11.50+, [[CUBRID]], [[MariaDB|MariaDB 10.2+]] and [[MySQL|MySQL 8.0.1+]].&lt;ref&gt;{{cite web |url=https://mysqlserverteam.com/mysql-8-0-labs-recursive-common-table-expressions-in-mysql-ctes/ |title=MySQL 8.0 Labs: [Recursive] Common Table Expressions in MySQL (CTEs)<ins style="font-weight: bold; text-decoration: none;"> |access-date=2017-12-20 |archive-date=2019-08-16 |archive-url=https://web.archive.org/web/20190816150345/https://mysqlserverteam.com/mysql-8-0-labs-recursive-common-table-expressions-in-mysql-ctes/ |url-status=dead </ins>}} mysqlserverteam.com&lt;/ref&gt; [https://kb.tableau.com/articles/howto/using-common-table-expressions Tableau has documentation] describing how CTEs can be used. TIBCO Spotfire does not support CTEs, while Oracle 11g Release 2's implementation lacks fixpoint semantics.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Without common table expressions or connected-by clauses it is possible to achieve hierarchical queries with user-defined recursive functions.&lt;ref&gt;[http://www.paragoncorporation.com/ArticleDetail.aspx?ArticleID=24 Paragon corporation: Using PostgreSQL User-Defined Functions to solve the Tree Problem], February 15, 2004, accessed September 19, 2015&lt;/ref&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Without common table expressions or connected-by clauses it is possible to achieve hierarchical queries with user-defined recursive functions.&lt;ref&gt;[http://www.paragoncorporation.com/ArticleDetail.aspx?ArticleID=24 Paragon corporation: Using PostgreSQL User-Defined Functions to solve the Tree Problem], February 15, 2004, accessed September 19, 2015&lt;/ref&gt;</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 64:</td> <td colspan="2" class="diff-lineno">Line 64:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}}&lt;/ref&gt; 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.&lt;ref name="MishraBeaulieu2004"&gt;{{cite book|author1=Sanjay Mishra|author2=Alan Beaulieu|title=Mastering Oracle SQL|url=https://books.google.com/books?id=r5vbGgz7TFsC&amp;pg=PT227|year=2004|publisher=O'Reilly Media, Inc.|isbn=978-0-596-00632-7|page=227}}&lt;/ref&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}}&lt;/ref&gt; 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.&lt;ref name="MishraBeaulieu2004"&gt;{{cite book|author1=Sanjay Mishra|author2=Alan Beaulieu|title=Mastering Oracle SQL|url=https://books.google.com/books?id=r5vbGgz7TFsC&amp;pg=PT227|year=2004|publisher=O'Reilly Media, Inc.|isbn=978-0-596-00632-7|page=227}}&lt;/ref&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;code&gt;CONNECT BY&lt;/code&gt; is supported by [[Snowflake Inc.|Snowflake]], [[EnterpriseDB]],&lt;ref&gt;[http://www.enterprisedb.com/documentation/hierarchical-queries.html Hierarchical Queries] {{Webarchive|url=https://web.archive.org/web/20080621031850/http://www.enterprisedb.com/documentation/hierarchical-queries.html |date=2008-06-21 }}, EnterpriseDB&lt;/ref&gt; [[Oracle database]],&lt;ref&gt;[http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm Hierarchical Queries], Oracle&lt;/ref&gt; [[CUBRID]],&lt;ref&gt;{{cite web|title=CUBRID Hierarchical Query|url=http://www.cubrid.org/manual/841/en/Hierarchical%20Query|access-date=11 February 2013}}&lt;/ref&gt; [[IBM Informix]]&lt;ref&gt;[https://www-01.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.sqls.doc/ids_sqs_2033.htm Hierarchical Clause], IBM Informix&lt;/ref&gt; and [[IBM Db2]] although only if it is enabled as a compatibility mode.&lt;ref name="Gennick2010"&gt;{{cite book|author=Jonathan Gennick|title=SQL Pocket Guide|url=https://books.google.com/books?id=rEAFRzMe_SMC&amp;pg=PA8|year=2010|publisher=O'Reilly Media, Inc.|isbn=978-1-4493-9409-7|page=8|edition=3rd}}&lt;/ref&gt; The syntax is as follows:</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;code&gt;CONNECT BY&lt;/code&gt; is supported by [[Snowflake Inc.|Snowflake]], [[EnterpriseDB]],&lt;ref&gt;[http://www.enterprisedb.com/documentation/hierarchical-queries.html Hierarchical Queries] {{Webarchive|url=https://web.archive.org/web/20080621031850/http://www.enterprisedb.com/documentation/hierarchical-queries.html |date=2008-06-21 }}, EnterpriseDB&lt;/ref&gt; [[Oracle database]],&lt;ref&gt;[http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm Hierarchical Queries], Oracle&lt;/ref&gt; [[CUBRID]],&lt;ref&gt;{{cite web|title=CUBRID Hierarchical Query|url=http://www.cubrid.org/manual/841/en/Hierarchical%20Query|access-date=11 February 2013<ins style="font-weight: bold; text-decoration: none;">|archive-date=14 February 2013|archive-url=https://web.archive.org/web/20130214060900/http://www.cubrid.org/manual/841/en/Hierarchical%20Query|url-status=dead</ins>}}&lt;/ref&gt; [[IBM Informix]]&lt;ref&gt;[https://www-01.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.sqls.doc/ids_sqs_2033.htm Hierarchical Clause], IBM Informix&lt;/ref&gt; and [[IBM Db2]] although only if it is enabled as a compatibility mode.&lt;ref name="Gennick2010"&gt;{{cite book|author=Jonathan Gennick|title=SQL Pocket Guide|url=https://books.google.com/books?id=rEAFRzMe_SMC&amp;pg=PA8|year=2010|publisher=O'Reilly Media, Inc.|isbn=978-1-4493-9409-7|page=8|edition=3rd}}&lt;/ref&gt; The syntax is as follows:</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> </tr> </table> InternetArchiveBot https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1196819577&oldid=prev A3nm: /* See also */ +RPQs 2024-01-18T16:21:36Z <p><span class="autocomment">See also: </span> +RPQs</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:21, 18 January 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 132:</td> <td colspan="2" class="diff-lineno">Line 132:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== See also ==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== See also ==</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* [[Datalog]] also implements fixpoint queries</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* [[Datalog]] also implements fixpoint queries</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* [[Regular path query|Regular path queries]] are a specific kind of recursive query in [[graph database]]s</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* [[Deductive database]]s</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* [[Deductive database]]s</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* [[Hierarchical model]]</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* [[Hierarchical model]]</div></td> </tr> </table> A3nm https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1180828226&oldid=prev HeyElliott: MOS:CQ 2023-10-19T02:50:13Z <p><a href="/wiki/MOS:CQ" class="mw-redirect" title="MOS:CQ">MOS:CQ</a></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 02:50, 19 October 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 23:</td> <td colspan="2" class="diff-lineno">Line 23:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>where &lt;code&gt;with_query&lt;/code&gt;<del style="font-weight: bold; text-decoration: none;">‘s</del> syntax is:</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>where &lt;code&gt;with_query&lt;/code&gt;<ins style="font-weight: bold; text-decoration: none;">'s</ins> syntax is:</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> </tr> </table> HeyElliott https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1178314371&oldid=prev Fusentast: /* Unary operators */ 2023-10-02T21:43:43Z <p><span class="autocomment">Unary operators</span></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 21:43, 2 October 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 116:</td> <td colspan="2" class="diff-lineno">Line 116:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>SELECT</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_5_0_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_2_0_lhs"></a><del style="font-weight: bold; text-decoration: none;">SELECT</del> <del style="font-weight: bold; text-decoration: none;">ename "Employee",</del> CONNECT_BY_ROOT ename "Manager",</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> ename "Employee",</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_5_2_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_4_0_lhs"></a><del style="font-weight: bold; text-decoration: none;">LEVEL-1</del> <del style="font-weight: bold; text-decoration: none;">"Pathlen",</del> SYS_CONNECT_BY_PATH(ename, '/') "Path"</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_2_0_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_5_0_rhs"></a> CONNECT_BY_ROOT ename<ins style="font-weight: bold; text-decoration: none;"> </ins> "Manager",</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> LEVEL-1 "Pathlen",</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_4_0_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_5_2_rhs"></a> SYS_CONNECT_BY_PATH(ename, '/') "Path"</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>FROM emp</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>FROM emp</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>WHERE LEVEL &gt; 1 <del style="font-weight: bold; text-decoration: none;">and</del> deptno = 10</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>WHERE LEVEL &gt; 1 <ins style="font-weight: bold; text-decoration: none;">AND</ins> deptno = 10</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>CONNECT BY PRIOR empno = mgr</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>CONNECT BY PRIOR empno = mgr</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ORDER BY "Employee", "Manager", "Pathlen", "Path";</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ORDER BY "Employee", "Manager", "Pathlen", "Path";</div></td> </tr> </table> Fusentast https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1178314134&oldid=prev Fusentast: /* Common table expression */ 2023-10-02T21:41:19Z <p><span class="autocomment">Common table expression</span></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 21:41, 2 October 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 39:</td> <td colspan="2" class="diff-lineno">Line 39:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>An example of a recursive query computing the [[factorial]] of numbers from 0 to 9 is the following:</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>An example of a recursive query computing the [[factorial]] of numbers from 0 to 9 is the following:</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang="sql"&gt;</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>WITH recursive temp (n, fact) AS</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>WITH recursive temp (n, fact) AS<ins style="font-weight: bold; text-decoration: none;"> (</ins></div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> SELECT 0, 1 -- Initial Subquery</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>(</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_8_0_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_4_0_rhs"></a> UNION ALL</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> SELECT 0,</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">1</del> -- <del style="font-weight: bold; text-decoration: none;">Initial</del> Subquery</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">SELECT</ins> <ins style="font-weight: bold; text-decoration: none;">n+1,</ins> <ins style="font-weight: bold; text-decoration: none;">(n+1)*fact</ins> <ins style="font-weight: bold; text-decoration: none;">FROM</ins> <ins style="font-weight: bold; text-decoration: none;">temp</ins> <ins style="font-weight: bold; text-decoration: none;">WHERE</ins> <ins style="font-weight: bold; text-decoration: none;">n</ins> <ins style="font-weight: bold; text-decoration: none;">&lt; 9</ins> -- <ins style="font-weight: bold; text-decoration: none;">Recursive</ins> Subquery</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>)</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_4_0_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_8_0_lhs"></a><del style="font-weight: bold; text-decoration: none;"> </del> UNION ALL</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_11_3_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_9_0_rhs"></a>SELECT *<ins style="font-weight: bold; text-decoration: none;"> FROM temp;</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> SELECT n+1,</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> (n+1)*fact</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> FROM temp -- Recursive Subquery</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> WHERE n &lt; 9)</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_9_0_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_11_3_lhs"></a>SELECT *</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>FROM temp;</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> Fusentast https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1125643414&oldid=prev Pngdeity at 02:42, 5 December 2022 2022-12-05T02:42:58Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 02:42, 5 December 2022</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 1:</td> <td colspan="2" class="diff-lineno">Line 1:</td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{Short description|none}}</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{Technical|date=April 2018}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{Technical|date=April 2018}}</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> Pngdeity https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1094019376&oldid=prev 151.28.147.223: Formatting the query for readability 2022-06-20T08:10:14Z <p>Formatting the query for readability</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 08:10, 20 June 2022</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 37:</td> <td colspan="2" class="diff-lineno">Line 37:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>An example of a recursive query computing the [[factorial]] of numbers from 0 to 9 is the following:</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>An example of a recursive query computing the [[factorial]] of numbers from 0 to 9 is the following:</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang=sql&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight lang=<ins style="font-weight: bold; text-decoration: none;">"</ins>sql<ins style="font-weight: bold; text-decoration: none;">"</ins>&gt;</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>WITH <del style="font-weight: bold; text-decoration: none;">RECURSIVE</del> temp (n, fact) AS<del style="font-weight: bold; text-decoration: none;"> </del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>WITH <ins style="font-weight: bold; text-decoration: none;">recursive</ins> temp (n, fact) AS</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>(</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>(SELECT 0, 1 -- Initial Subquery</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> SELECT 0,</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> UNION ALL </div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> SELECT</del> <del style="font-weight: bold; text-decoration: none;">n+1,</del> <del style="font-weight: bold; text-decoration: none;">(n+1)*fact</del> <del style="font-weight: bold; text-decoration: none;">FROM</del> <del style="font-weight: bold; text-decoration: none;">temp</del> -- <del style="font-weight: bold; text-decoration: none;">Recursive</del> Subquery<del style="font-weight: bold; text-decoration: none;"> </del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;"> 1</ins> -- <ins style="font-weight: bold; text-decoration: none;">Initial</ins> Subquery</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">WHERE n &lt; 9)</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">UNION</ins> <ins style="font-weight: bold; text-decoration: none;">ALL</ins></div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> SELECT n+1,</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_9_3_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_8_0_lhs"></a>SELECT *<del style="font-weight: bold; text-decoration: none;"> FROM temp;</del></div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> (n+1)*fact</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> FROM temp -- Recursive Subquery</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> WHERE n &lt; 9)</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_8_0_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_9_3_rhs"></a>SELECT *</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>FROM temp;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> 151.28.147.223 https://en.wikipedia.org/w/index.php?title=Hierarchical_and_recursive_queries_in_SQL&diff=1083809008&oldid=prev Liz: Removing link(s) to "Database System Concepts": Removing links to deleted page Database System Concepts. 2022-04-20T21:15:50Z <p>Removing link(s) to &quot;Database System Concepts&quot;: Removing links to deleted page Database System Concepts.</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 21:15, 20 April 2022</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 140:</td> <td colspan="2" class="diff-lineno">Line 140:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author=C. J. Date|author-link=C. J. Date|title=SQL and Relational Theory: How to Write Accurate SQL Code|year=2011|publisher=O'Reilly Media|isbn=978-1-4493-1640-2|edition=2nd|pages=159–163}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author=C. J. Date|author-link=C. J. Date|title=SQL and Relational Theory: How to Write Accurate SQL Code|year=2011|publisher=O'Reilly Media|isbn=978-1-4493-1640-2|edition=2nd|pages=159–163}}</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>'''Academic textbooks'''. Note that these cover only the SQL:1999 standard (and Datalog), but not the Oracle extension.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>'''Academic textbooks'''. Note that these cover only the SQL:1999 standard (and Datalog), but not the Oracle extension.</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author1=Abraham Silberschatz|author2=Henry Korth|author3=S. Sudarshan|title=<del style="font-weight: bold; text-decoration: none;">[[</del>Database System Concepts<del style="font-weight: bold; text-decoration: none;">]]</del>|year=2010|edition=6th|publisher=McGraw-Hill|isbn=978-0-07-352332-3|pages=187–192}}</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author1=Abraham Silberschatz|author2=Henry Korth|author3=S. Sudarshan|title=Database System Concepts|year=2010|edition=6th|publisher=McGraw-Hill|isbn=978-0-07-352332-3|pages=187–192}}</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author1=Raghu Ramakrishnan|author2=Johannes Gehrke|title=Database management systems|year=2003|publisher=McGraw-Hill|isbn=978-0-07-246563-1|edition=3rd}} Chapter 24.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author1=Raghu Ramakrishnan|author2=Johannes Gehrke|title=Database management systems|year=2003|publisher=McGraw-Hill|isbn=978-0-07-246563-1|edition=3rd}} Chapter 24.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author1=Hector Garcia-Molina|author2=Jeffrey D. Ullman|author3=Jennifer Widom|title=Database systems: the complete book|year=2009|publisher=Pearson Prentice Hall|isbn=978-0-13-187325-4|edition=2nd|pages=437–445}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite book|author1=Hector Garcia-Molina|author2=Jeffrey D. Ullman|author3=Jennifer Widom|title=Database systems: the complete book|year=2009|publisher=Pearson Prentice Hall|isbn=978-0-13-187325-4|edition=2nd|pages=437–445}}</div></td> </tr> </table> Liz