Knowledge (XXG)

Hierarchical and recursive queries in SQL

Source đź“ť

162: 2070: 2080: 2090: 24: 750:
7902 2 | BLAKE | 7698 | 7839 3 | ALLEN | 7499 | 7698 3 | WARD | 7521 | 7698 3 | MARTIN | 7654 | 7698 3 | TURNER | 7844 | 7698 3 | JAMES | 7900 | 7698 2 | CLARK | 7782 | 7839 3 | MILLER | 7934 | 7782 (14 rows)
528:
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
749:
level | employee | empno | manager -------+-------------+-------+--------- 1 | KING | 7839 | 2 | JONES | 7566 | 7839 3 | SCOTT | 7788 | 7566 4 | ADAMS | 7876 | 7788 3 | FORD | 7902 | 7566 4 | SMITH | 7369 |
110:, recursive CTEs were designed with fixpoint semantics from the beginning. Recursive CTEs from the standard were relatively close to the existing implementation in IBM DB2 version 2. Recursive CTEs are also supported by 785:
The following example returns the last name of each employee in department 10, each manager above that employee in the hierarchy, the number of levels between manager and employee, and the path between the two:
1680: 291: 42: 348:
Recursive CTEs can be used to traverse relations (as graphs or trees) although the syntax is much more involved because there are no automatic pseudo-columns created (like
1109: 376:, one can populate a table with data generated from a recursive query; random data generation is possible using this technique without using any procedural statements. 1663: 1675: 1211: 1146: 1396: 149:
Without common table expressions or connected-by clauses it is possible to achieve hierarchical queries with user-defined recursive functions.
1572: 1552: 1533: 1506: 1474: 1378: 1351: 1304: 1277: 1250: 1195: 1018: 146:
describing how CTEs can be used. TIBCO Spotfire does not support CTEs, while Oracle 11g Release 2's implementation lacks fixpoint semantics.
1225: 2114: 2073: 379:
Some Databases, like PostgreSQL, support a shorter CREATE RECURSIVE VIEW format which is internally translated into WITH RECURSIVE coding.
1746: 1635: 1425: 1158: 2093: 60: 1450: 365:
In SQL:1999 a recursive (CTE) query may appear anywhere a query is allowed. It's possible, for example, to name the result using
355:); if these are desired, they have to be created in the code. See MSDN documentation or IBM documentation for tutorial examples. 1588: 1799: 1113: 2050: 1697: 1593: 1989: 2015: 1734: 1938: 1928: 1704: 239: 115: 2025: 1758: 1412: 1147:
https://firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-2.5-LangRef-Update.pdf
1608: 1984: 1974: 1628: 1687: 196:) is a temporary named result set, derived from a simple query and defined within the execution scope of a 2055: 2010: 1598: 1603: 2030: 1784: 1079: 143: 1393: 2083: 2020: 1902: 1872: 1741: 1692: 243: 111: 1134: 2040: 1933: 1918: 1845: 1670: 1159:
https://stackoverflow.com/questions/42579298/why-does-a-with-clause-give-a-syntax-error-on-informix
2124: 2035: 1979: 1948: 1897: 1729: 1621: 1170: 979: 969: 964: 955: 90: 82: 1789: 1519:. Note that these cover only the SQL:1999 standard (and Datalog), but not the Oracle extension. 1320: 1059: 1855: 1709: 1568: 1548: 1529: 1502: 1470: 1374: 1368: 1347: 1300: 1294: 1273: 1267: 1246: 1191: 1185: 1014: 1008: 279: 1589:
https://stackoverflow.com/questions/1731889/cycle-detection-with-recursive-subquery-factoring
1240: 2045: 1892: 1882: 1850: 1464: 1339: 1334:
Benedikt, M.; Senellart, P. (2011). "Databases". In Blum, Edward K.; Aho, Alfred V. (eds.).
1429: 1953: 1923: 1877: 1658: 1400: 544: 247: 220: 1594:
http://explainextended.com/2009/11/18/sql-server-are-the-recursive-ctes-really-set-based/
1038: 2005: 1943: 1887: 1860: 1753: 1714: 984: 959: 536: 1135:
Paragon corporation: Using PostgreSQL User-Defined Functions to solve the Tree Problem
161: 2108: 1824: 1809: 2119: 974: 552: 540: 271: 127: 78: 559:
although only if it is enabled as a compatibility mode. The syntax is as follows:
1343: 1814: 1794: 1184:
Karen Morton; Robyn Sands; Jared Still; Riyaj Shamsudeen; Kerry Osborne (2010).
1958: 1867: 1829: 1804: 1613: 1494: 1110:"MySQL 8.0 Labs: [Recursive] Common Table Expressions in MySQL (CTEs)" 251: 119: 383: 287: 362:
keyword is not usually needed after WITH in systems other than PostgreSQL.
1609:
http://www.blacktdn.com.br/2015/06/blacktdn-mssql-usando-consulta-cte.html
1819: 1774: 1644: 275: 235: 227: 216: 97: 86: 297:
The syntax for a CTE (which may or may not be recursive) is as follows:
1599:
https://web.archive.org/web/20131114094211/http://gennick.com/with.html
1094: 949: 556: 283: 255: 231: 135: 1604:
http://www.cs.duke.edu/courses/fall04/cps116/lectures/11-recursion.pdf
1724: 548: 267: 263: 131: 123: 1719: 259: 139: 1779: 1563:
Hector Garcia-Molina; Jeffrey D. Ullman; Jennifer Widom (2009).
1617: 193: 156: 17: 215:
CTEs can be thought of as alternatives to derived tables (
1567:(2nd ed.). Pearson Prentice Hall. pp. 437–445. 1499:
SQL and Relational Theory: How to Write Accurate SQL Code
100:
hierarchical queries are implemented by way of recursive
1524:
Abraham Silberschatz; Henry Korth; S. Sudarshan (2010).
1336:
Computer Science. The Hardware, Software and Heart of It
173: 85:
data. They are special cases of more general recursive
38: 1269:
SQL:1999: Understanding Relational Language Components
1010:
SQL:1999: Understanding Relational Language Components
1998: 1967: 1911: 1838: 1767: 1651: 33:
may be too technical for most readers to understand
1501:(2nd ed.). O'Reilly Media. pp. 159–163. 1039:"Recursive Queries Using Common Table Expressions" 746:The output from the above query would look like: 1469:(3rd ed.). O'Reilly Media, Inc. p. 8. 1137:, February 15, 2004, accessed September 19, 2015 1528:(6th ed.). McGraw-Hill. pp. 187–192. 382:An example of a recursive query computing the 1629: 8: 1543:Raghu Ramakrishnan; Johannes Gehrke (2003). 1002: 1000: 102: 1032: 1030: 294:. Oracle calls CTEs "subquery factoring". 1636: 1622: 1614: 1296:A Complete Guide to DB2 Universal Database 958:are a specific kind of recursive query in 524:An alternative syntax is the non-standard 226:Common table expressions are supported by 386:of numbers from 0 to 9 is the following: 61:Learn how and when to remove this message 45:, without removing the technical details. 1157:possible before 14.10 with temp tables 996: 192:A common table expression, or CTE, (in 250:(with recursion since 11g release 2), 1367:Sanjay Mishra; Alan Beaulieu (2004). 1299:. Morgan Kaufmann. pp. 253–254. 223:, and inline user-defined functions. 43:make it understandable to non-experts 7: 1373:. O'Reilly Media, Inc. p. 227. 2089: 1565:Database systems: the complete book 352: 1266:Jim Melton; Alan R. Simon (2002). 1007:Jim Melton; Alan R. Simon (2002). 14: 2088: 2078: 2069: 2068: 1272:. Morgan Kaufmann. p. 352. 952:also implements fixpoint queries 160: 106:(CTEs). Unlike Oracle's earlier 22: 2079: 107: 1245:. O'Reilly Media. p. 94. 246:(starting with version 2005), 238:(starting with version 14.1), 1: 1547:(3rd ed.). McGraw-Hill. 242:(starting with version 2.1), 1344:10.1007/978-1-4614-1168-0_10 1239:Regina Obe; Leo Hsu (2012). 1060:"Firebird 2.1 Release Notes" 230:(starting with version 14), 114:(since SQL Server 2008 R2), 2115:Database management systems 1645:Database management systems 1545:Database management systems 1426:"CUBRID Hierarchical Query" 1058:Helen Borrie (2008-07-15). 282:(starting with version 9), 2141: 2051:Object–relational database 1242:PostgreSQL: Up and Running 2064: 2026:Federated database system 1759:Blockchain-based database 1463:Jonathan Gennick (2010). 144:Tableau has documentation 1526:Database System Concepts 788: 633: 561: 388: 372:. Using a CTE inside an 322: 299: 103:common table expressions 1293:Don Chamberlin (1998). 1190:. Apress. p. 283. 153:Common table expression 89:queries, which compute 2056:Transaction processing 2011:Database normalization 1954:Query rewriting system 274:(since 14.10), Google 2031:Referential integrity 496:-- Recursive Subquery 2021:Distributed database 1413:Hierarchical Queries 1394:Hierarchical Queries 1370:Mastering Oracle SQL 956:Regular path queries 905:"Employee" 797:"Employee" 684:"employee" 290:(experimental), and 244:Microsoft SQL Server 112:Microsoft SQL Server 2041:Relational calculus 1919:Concurrency control 1451:Hierarchical Clause 1432:on 14 February 2013 1323:. 10 February 2022. 1125:mysqlserverteam.com 1082:. 10 February 2022. 1013:. Morgan Kaufmann. 965:Deductive databases 938:SYS_CONNECT_BY_PATH 917:"Pathlen" 911:"Manager" 830:SYS_CONNECT_BY_PATH 824:"Pathlen" 809:"Manager" 699:"manager" 433:-- Initial Subquery 91:transitive closures 2036:Relational algebra 1980:Query optimization 1785:Armstrong's axioms 1517:Academic textbooks 1399:2008-06-21 at the 980:Transitive closure 970:Hierarchical model 770:CONNECT_BY_ISCYCLE 172:. You can help by 83:hierarchical model 75:hierarchical query 2102: 2101: 1710:Wide-column store 1705:Document-oriented 1574:978-0-13-187325-4 1554:978-0-07-246563-1 1535:978-0-07-352332-3 1508:978-1-4493-1640-2 1476:978-1-4493-9409-7 1380:978-0-596-00632-7 1353:978-1-4614-1167-3 1306:978-1-55860-482-7 1279:978-1-55860-456-8 1252:978-1-4493-2633-3 1197:978-1-4302-3228-5 1020:978-1-55860-456-8 765:CONNECT_BY_ISLEAF 190: 189: 108:connect-by clause 71: 70: 63: 2132: 2092: 2091: 2082: 2081: 2072: 2071: 2046:Relational model 2016:Database storage 1893:Stored procedure 1638: 1631: 1624: 1615: 1578: 1558: 1539: 1512: 1481: 1480: 1466:SQL Pocket Guide 1460: 1454: 1448: 1442: 1441: 1439: 1437: 1428:. Archived from 1422: 1416: 1410: 1404: 1391: 1385: 1384: 1364: 1358: 1357: 1331: 1325: 1324: 1317: 1311: 1310: 1290: 1284: 1283: 1263: 1257: 1256: 1236: 1230: 1229: 1222: 1216: 1215: 1208: 1202: 1201: 1181: 1175: 1174: 1167: 1161: 1155: 1149: 1144: 1138: 1132: 1126: 1124: 1122: 1121: 1112:. Archived from 1106: 1100: 1098: 1091: 1085: 1083: 1076: 1070: 1069: 1067: 1066: 1055: 1049: 1048: 1046: 1045: 1034: 1025: 1024: 1004: 939: 927: 924: 923:"Path" 921: 918: 915: 912: 909: 906: 903: 900: 897: 894: 891: 888: 885: 882: 879: 876: 873: 870: 867: 864: 861: 858: 855: 852: 849: 848:"Path" 846: 843: 840: 837: 834: 831: 828: 825: 822: 819: 816: 813: 810: 807: 804: 801: 798: 795: 792: 776: 771: 766: 761: 742: 739: 736: 733: 730: 727: 724: 721: 718: 715: 712: 709: 706: 703: 700: 697: 694: 691: 688: 685: 682: 679: 676: 673: 670: 667: 664: 661: 658: 655: 652: 649: 646: 643: 640: 637: 625: 622: 619: 616: 613: 610: 607: 604: 601: 598: 595: 592: 589: 586: 583: 580: 577: 574: 573:table_expression 571: 568: 565: 535:is supported by 534: 529:cycles as well. 527: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 375: 371: 368: 361: 351: 344: 341: 338: 335: 332: 329: 326: 319: 312: 309: 306: 303: 211: 207: 203: 199: 185: 182: 164: 157: 130:version 11.50+, 66: 59: 55: 52: 46: 26: 25: 18: 2140: 2139: 2135: 2134: 2133: 2131: 2130: 2129: 2105: 2104: 2103: 2098: 2060: 2006:Database models 1994: 1963: 1949:Query optimizer 1924:Data dictionary 1907: 1878:Transaction log 1834: 1790:Codd's 12 rules 1763: 1693:Column-oriented 1659:Object-oriented 1647: 1642: 1585: 1575: 1562: 1555: 1542: 1536: 1523: 1509: 1493: 1490: 1488:Further reading 1485: 1484: 1477: 1462: 1461: 1457: 1449: 1445: 1435: 1433: 1424: 1423: 1419: 1411: 1407: 1401:Wayback Machine 1392: 1388: 1381: 1366: 1365: 1361: 1354: 1338:. p. 189. 1333: 1332: 1328: 1319: 1318: 1314: 1307: 1292: 1291: 1287: 1280: 1265: 1264: 1260: 1253: 1238: 1237: 1233: 1224: 1223: 1219: 1210: 1209: 1205: 1198: 1183: 1182: 1178: 1169: 1168: 1164: 1156: 1152: 1145: 1141: 1133: 1129: 1119: 1117: 1108: 1107: 1103: 1093: 1092: 1088: 1078: 1077: 1073: 1064: 1062: 1057: 1056: 1052: 1043: 1041: 1036: 1035: 1028: 1021: 1006: 1005: 998: 993: 960:graph databases 946: 937: 934: 929: 928: 925: 922: 919: 916: 913: 910: 907: 904: 901: 898: 895: 892: 889: 886: 883: 880: 877: 874: 871: 868: 865: 862: 859: 856: 853: 850: 847: 844: 841: 838: 835: 832: 829: 826: 823: 820: 817: 814: 811: 808: 805: 803:CONNECT_BY_ROOT 802: 799: 796: 793: 790: 783: 781:Unary operators 775:CONNECT_BY_ROOT 774: 769: 764: 759: 756: 751: 744: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 710: 707: 704: 701: 698: 695: 692: 689: 686: 683: 680: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 627: 626: 623: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 545:Oracle database 532: 525: 522: 517: 516: 513: 510: 507: 504: 501: 498: 495: 492: 489: 486: 483: 480: 477: 474: 471: 468: 465: 462: 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 373: 369: 366: 359: 349: 346: 345: 342: 339: 336: 333: 330: 327: 324: 317: 314: 313: 310: 307: 304: 301: 266:(since 3.8.3), 209: 205: 201: 197: 186: 180: 177: 170:needs expansion 155: 120:PostgreSQL 8.4+ 67: 56: 50: 47: 39:help improve it 36: 27: 23: 12: 11: 5: 2138: 2136: 2128: 2127: 2122: 2117: 2107: 2106: 2100: 2099: 2097: 2096: 2086: 2076: 2065: 2062: 2061: 2059: 2058: 2053: 2048: 2043: 2038: 2033: 2028: 2023: 2018: 2013: 2008: 2002: 2000: 1999:Related topics 1996: 1995: 1993: 1992: 1987: 1982: 1977: 1975:Administration 1971: 1969: 1965: 1964: 1962: 1961: 1956: 1951: 1946: 1944:Query language 1941: 1936: 1931: 1926: 1921: 1915: 1913: 1909: 1908: 1906: 1905: 1900: 1895: 1890: 1885: 1880: 1875: 1870: 1865: 1864: 1863: 1858: 1853: 1842: 1840: 1836: 1835: 1833: 1832: 1827: 1822: 1817: 1812: 1807: 1802: 1797: 1792: 1787: 1782: 1777: 1771: 1769: 1765: 1764: 1762: 1761: 1756: 1751: 1750: 1749: 1739: 1738: 1737: 1727: 1722: 1717: 1712: 1707: 1702: 1701: 1700: 1690: 1685: 1684: 1683: 1678: 1668: 1667: 1666: 1655: 1653: 1649: 1648: 1643: 1641: 1640: 1633: 1626: 1618: 1612: 1611: 1606: 1601: 1596: 1591: 1584: 1583:External links 1581: 1580: 1579: 1573: 1560: 1553: 1540: 1534: 1514: 1513: 1507: 1489: 1486: 1483: 1482: 1475: 1455: 1453:, IBM Informix 1443: 1417: 1405: 1403:, EnterpriseDB 1386: 1379: 1359: 1352: 1326: 1312: 1305: 1285: 1278: 1258: 1251: 1231: 1217: 1203: 1196: 1187:Pro Oracle SQL 1176: 1162: 1150: 1139: 1127: 1101: 1086: 1080:"WITH Queries" 1071: 1050: 1026: 1019: 995: 994: 992: 989: 988: 987: 985:Tree structure 982: 977: 972: 967: 962: 953: 945: 942: 941: 940: 933: 930: 789: 782: 779: 778: 777: 772: 767: 762: 755: 754:Pseudo-columns 752: 748: 634: 632: 631: 562: 521: 518: 389: 323: 320:'s syntax is: 300: 258:(since 10.2), 188: 187: 167: 165: 154: 151: 69: 68: 30: 28: 21: 13: 10: 9: 6: 4: 3: 2: 2137: 2126: 2123: 2121: 2118: 2116: 2113: 2112: 2110: 2095: 2087: 2085: 2077: 2075: 2067: 2066: 2063: 2057: 2054: 2052: 2049: 2047: 2044: 2042: 2039: 2037: 2034: 2032: 2029: 2027: 2024: 2022: 2019: 2017: 2014: 2012: 2009: 2007: 2004: 2003: 2001: 1997: 1991: 1988: 1986: 1983: 1981: 1978: 1976: 1973: 1972: 1970: 1966: 1960: 1957: 1955: 1952: 1950: 1947: 1945: 1942: 1940: 1937: 1935: 1932: 1930: 1927: 1925: 1922: 1920: 1917: 1916: 1914: 1910: 1904: 1901: 1899: 1896: 1894: 1891: 1889: 1886: 1884: 1881: 1879: 1876: 1874: 1871: 1869: 1866: 1862: 1859: 1857: 1854: 1852: 1849: 1848: 1847: 1844: 1843: 1841: 1837: 1831: 1828: 1826: 1825:Surrogate key 1823: 1821: 1818: 1816: 1813: 1811: 1810:Candidate key 1808: 1806: 1803: 1801: 1798: 1796: 1793: 1791: 1788: 1786: 1783: 1781: 1778: 1776: 1773: 1772: 1770: 1766: 1760: 1757: 1755: 1752: 1748: 1745: 1744: 1743: 1740: 1736: 1733: 1732: 1731: 1728: 1726: 1723: 1721: 1718: 1716: 1713: 1711: 1708: 1706: 1703: 1699: 1696: 1695: 1694: 1691: 1689: 1686: 1682: 1679: 1677: 1674: 1673: 1672: 1669: 1665: 1662: 1661: 1660: 1657: 1656: 1654: 1650: 1646: 1639: 1634: 1632: 1627: 1625: 1620: 1619: 1616: 1610: 1607: 1605: 1602: 1600: 1597: 1595: 1592: 1590: 1587: 1586: 1582: 1576: 1570: 1566: 1561: 1556: 1550: 1546: 1541: 1537: 1531: 1527: 1522: 1521: 1520: 1518: 1510: 1504: 1500: 1496: 1492: 1491: 1487: 1478: 1472: 1468: 1467: 1459: 1456: 1452: 1447: 1444: 1431: 1427: 1421: 1418: 1414: 1409: 1406: 1402: 1398: 1395: 1390: 1387: 1382: 1376: 1372: 1371: 1363: 1360: 1355: 1349: 1345: 1341: 1337: 1330: 1327: 1322: 1321:"Create View" 1316: 1313: 1308: 1302: 1298: 1297: 1289: 1286: 1281: 1275: 1271: 1270: 1262: 1259: 1254: 1248: 1244: 1243: 1235: 1232: 1227: 1221: 1218: 1213: 1207: 1204: 1199: 1193: 1189: 1188: 1180: 1177: 1172: 1166: 1163: 1160: 1154: 1151: 1148: 1143: 1140: 1136: 1131: 1128: 1116:on 2019-08-16 1115: 1111: 1105: 1102: 1096: 1095:"WITH Clause" 1090: 1087: 1081: 1075: 1072: 1061: 1054: 1051: 1040: 1033: 1031: 1027: 1022: 1016: 1012: 1011: 1003: 1001: 997: 990: 986: 983: 981: 978: 976: 973: 971: 968: 966: 963: 961: 957: 954: 951: 948: 947: 943: 936: 935: 931: 787: 780: 773: 768: 763: 758: 757: 753: 747: 629: 628: 560: 558: 554: 550: 546: 542: 538: 530: 519: 387: 385: 380: 377: 363: 356: 354: 321: 298: 295: 293: 289: 285: 281: 277: 273: 269: 265: 262:(since 8.0), 261: 257: 254:(since 8.4), 253: 249: 245: 241: 237: 233: 229: 224: 222: 218: 213: 195: 184: 181:November 2012 175: 171: 168:This section 166: 163: 159: 158: 152: 150: 147: 145: 141: 137: 136:MariaDB 10.2+ 133: 129: 125: 124:SQLite 3.8.3+ 121: 117: 113: 109: 105: 104: 99: 94: 92: 88: 84: 81:that handles 80: 77:is a type of 76: 65: 62: 54: 44: 40: 34: 31:This article 29: 20: 19: 16: 1564: 1544: 1525: 1516: 1515: 1498: 1465: 1458: 1446: 1434:. Retrieved 1430:the original 1420: 1408: 1389: 1369: 1362: 1335: 1329: 1315: 1295: 1288: 1268: 1261: 1241: 1234: 1220: 1206: 1186: 1179: 1165: 1153: 1142: 1130: 1118:. Retrieved 1114:the original 1104: 1089: 1074: 1063:. Retrieved 1053: 1042:. Retrieved 1009: 975:Reachability 784: 745: 630:For example, 553:IBM Informix 541:EnterpriseDB 531: 523: 381: 378: 364: 357: 347: 315: 296: 225: 214: 191: 178: 174:adding to it 169: 148: 140:MySQL 8.0.1+ 128:IBM Informix 116:Firebird 2.1 101: 96:In standard 95: 74: 72: 57: 48: 32: 15: 2094:WikiProject 1985:Replication 1873:Transaction 1815:Foreign key 1795:CAP theorem 1742:Multi-model 1559:Chapter 24. 1436:11 February 1037:Microsoft. 842:'/' 651:' ' 600:parent_expr 594:parent_expr 567:select_list 374:INSERT INTO 292:many others 212:statement. 2109:Categories 1959:Query plan 1912:Components 1830:Unique key 1747:comparison 1681:comparison 1671:Relational 1664:comparison 1495:C. J. Date 1226:"IBM Docs" 1212:"IBM Docs" 1171:"Advanced" 1120:2017-12-20 1084:PostgreSQL 1065:2015-11-24 1044:2009-12-23 991:References 609:child_expr 588:child_expr 533:CONNECT BY 526:CONNECT BY 520:CONNECT BY 325:query_name 318:with_query 305:with_query 252:PostgreSQL 51:April 2018 2125:Recursion 1968:Functions 1903:Partition 1730:In-memory 1688:Key–value 932:Functions 537:Snowflake 394:recursive 384:factorial 360:RECURSIVE 79:SQL query 2074:Category 1990:Sharding 1846:Relation 1820:Superkey 1775:Database 1768:Concepts 1497:(2011). 1415:, Oracle 1397:Archived 944:See also 276:BigQuery 272:Informix 268:HyperSQL 240:Firebird 236:Informix 228:Teradata 217:subquery 98:SQL:1999 87:fixpoint 2084:Outline 1883:Trigger 1839:Objects 950:Datalog 881:CONNECT 723:CONNECT 576:CONNECT 557:IBM Db2 284:Vertica 256:MariaDB 232:IBM Db2 37:Please 1898:Cursor 1856:column 1725:NewSQL 1571:  1551:  1532:  1505:  1473:  1377:  1350:  1303:  1276:  1249:  1194:  1099:SQLite 1017:  872:deptno 791:SELECT 636:SELECT 564:SELECT 549:CUBRID 502:SELECT 442:SELECT 421:SELECT 367:CREATE 340:SELECT 316:where 308:SELECT 280:Sybase 264:SQLite 248:Oracle 210:DELETE 206:UPDATE 202:INSERT 198:SELECT 132:CUBRID 1888:Index 1851:table 1754:Cloud 1720:NoSQL 1715:Graph 1652:Types 899:ORDER 890:empno 887:PRIOR 860:LEVEL 857:WHERE 836:ename 815:LEVEL 806:ename 794:ename 760:LEVEL 732:empno 729:PRIOR 708:START 690:empno 681:ename 666:LEVEL 639:LEVEL 606:PRIOR 585:PRIOR 484:WHERE 436:UNION 353:below 350:LEVEL 260:MySQL 221:views 208:, or 1939:ODBC 1929:JDBC 1868:View 1805:Null 1800:CRUD 1780:ACID 1735:list 1698:list 1676:list 1569:ISBN 1549:ISBN 1530:ISBN 1503:ISBN 1471:ISBN 1438:2013 1375:ISBN 1348:ISBN 1301:ISBN 1274:ISBN 1247:ISBN 1192:ISBN 1015:ISBN 863:> 851:FROM 720:NULL 711:WITH 702:FROM 645:LPAD 570:FROM 555:and 511:temp 508:FROM 490:< 481:temp 478:FROM 475:fact 409:fact 397:temp 391:WITH 370:VIEW 358:The 343:...) 302:WITH 138:and 2120:SQL 1934:XQJ 1861:row 1340:doi 896:mgr 869:AND 854:emp 738:mgr 714:mgr 705:emp 696:mgr 624:... 618:... 439:ALL 311:... 219:), 194:SQL 176:. 41:to 2111:: 1346:. 1029:^ 999:^ 902:BY 884:BY 878:10 726:BY 717:IS 678:|| 675:)) 579:BY 551:, 547:, 543:, 539:, 415:AS 334:AS 288:H2 286:, 278:, 270:, 234:, 204:, 200:, 142:. 134:, 126:, 122:, 118:, 93:. 73:A 1637:e 1630:t 1623:v 1577:. 1557:. 1538:. 1511:. 1479:. 1440:. 1383:. 1356:. 1342:: 1309:. 1282:. 1255:. 1228:. 1214:. 1200:. 1173:. 1123:. 1097:. 1068:. 1047:. 1023:. 926:; 920:, 914:, 908:, 893:= 875:= 866:1 845:) 839:, 833:( 827:, 821:1 818:- 812:, 800:, 741:; 735:= 693:, 687:, 672:1 669:- 663:( 660:* 657:2 654:, 648:( 642:, 621:] 615:] 612:} 603:= 597:| 591:= 582:{ 514:; 505:* 499:) 493:9 487:n 472:* 469:) 466:1 463:+ 460:n 457:( 454:, 451:1 448:+ 445:n 430:1 427:, 424:0 418:( 412:) 406:, 403:n 400:( 337:( 331:] 328:) 183:) 179:( 64:) 58:( 53:) 49:( 35:.

Index

help improve it
make it understandable to non-experts
Learn how and when to remove this message
SQL query
hierarchical model
fixpoint
transitive closures
SQL:1999
common table expressions
connect-by clause
Microsoft SQL Server
Firebird 2.1
PostgreSQL 8.4+
SQLite 3.8.3+
IBM Informix
CUBRID
MariaDB 10.2+
MySQL 8.0.1+
Tableau has documentation

adding to it
SQL
subquery
views
Teradata
IBM Db2
Informix
Firebird
Microsoft SQL Server
Oracle

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑