{"id":789,"date":"2019-05-07T23:28:02","date_gmt":"2019-05-07T16:28:02","guid":{"rendered":"http:\/\/www.oopsbox.com\/?p=789"},"modified":"2019-05-07T23:28:02","modified_gmt":"2019-05-07T16:28:02","slug":"mysql-generates-a-sequence-of-numeric-values","status":"publish","type":"post","link":"https:\/\/www.oopsbox.com\/?p=789","title":{"rendered":"MySQL generates a sequence of numeric values"},"content":{"rendered":"<p>\u0e2b\u0e25\u0e31\u0e07\u0e08\u0e32\u0e01\u0e44\u0e14\u0e49\u0e2d\u0e48\u0e32\u0e19\u0e41\u0e25\u0e30\u0e25\u0e2d\u0e07 <a href=\"https:\/\/mariadb.com\/kb\/en\/library\/sequence-overview\/\">Sequence<\/a> \u0e43\u0e19 MariaDB 10.3 \u0e41\u0e25\u0e49\u0e27 \u0e21\u0e31\u0e19\u0e0a\u0e48\u0e32\u0e07\u0e07\u0e48\u0e32\u0e22\u0e40\u0e2b\u0e25\u0e37\u0e2d\u0e40\u0e01\u0e34\u0e19\u0e43\u0e2b\u0e49\u0e15\u0e32\u0e22\u0e40\u0e16\u0e2d\u0e30\u0e42\u0e23\u0e1a\u0e34\u0e19 (\u0e41\u0e19\u0e30\u0e19\u0e33\u0e43\u0e2b\u0e49\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u0e22\u0e31\u0e07\u0e44\u0e07\u0e01\u0e47\u0e44\u0e14\u0e49\u0e43\u0e0a\u0e49\u0e41\u0e19\u0e48 \u0e46 ) \u0e41\u0e15\u0e48\u0e1a\u0e25\u0e4a\u0e2d\u0e01\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e08\u0e30\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e19\u0e35\u0e49 5555 \u0e40\u0e23\u0e32\u0e08\u0e30\u0e43\u0e0a\u0e49\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48\u0e40\u0e23\u0e35\u0e22\u0e01\u0e27\u0e48\u0e32 CTE (Common Table Expression) \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e0a\u0e38\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 CTE \u0e0b\u0e36\u0e48\u0e07\u0e40\u0e23\u0e34\u0e48\u0e21\u0e43\u0e0a\u0e49\u0e44\u0e14\u0e49\u0e43\u0e19 MySQL 8.0, MariaDB 10.2 \u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e19\u0e21\u0e32\u0e0b\u0e36\u0e48\u0e07\u0e40\u0e2d\u0e32\u0e08\u0e23\u0e34\u0e07 \u0e46 \u0e01\u0e47\u0e07\u0e48\u0e32\u0e22\u0e1e\u0e2d \u0e46 \u0e01\u0e31\u0e19\u0e41\u0e2b\u0e25\u0e48\u0e30 \u0e40\u0e23\u0e32\u0e40\u0e04\u0e22\u0e40\u0e02\u0e35\u0e22\u0e19\u0e43\u0e19<a href=\"https:\/\/www.oopsbox.com\/?p=603\">\u0e1a\u0e17\u0e04\u0e27\u0e32\u0e21\u0e40\u0e01\u0e48\u0e32 \u0e46<\/a> \u0e25\u0e2d\u0e07\u0e44\u0e1b\u0e2b\u0e32\u0e2d\u0e48\u0e32\u0e19\u0e01\u0e31\u0e19\u0e44\u0e14\u0e49 <a href=\"https:\/\/www.youtube.com\/watch?v=oYZGSz71kKM\" data-rel=\"lightbox-video-0\" target=\"_blank\" rel=\"noopener noreferrer\">\u0e2b\u0e23\u0e37\u0e2d\u0e02\u0e2d\u0e07 \u0e2d.\u0e1b\u0e23\u0e30\u0e40\u0e2a\u0e23\u0e34\u0e10<\/a><\/p>\n<p>\u0e25\u0e31\u0e01\u0e29\u0e13\u0e02\u0e2d\u0e07 CTE \u0e43\u0e0a\u0e49\u0e01\u0e32\u0e23\u0e40\u0e23\u0e35\u0e22\u0e01\u0e42\u0e14\u0e22\u0e27\u0e34\u0e18\u0e35 Recursive \u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e43\u0e19 MySQL \u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e41\u0e1a\u0e1a\u0e19\u0e35\u0e49<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">with_clause:\r\n    WITH [RECURSIVE]\r\n        cte_name [(col_name [, col_name] ...)] AS (subquery)\r\n        [, cte_name [(col_name [, col_name] ...)] AS (subquery)] ...<\/pre>\n<p>\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e02\u0e2d\u0e07\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e19\u0e35\u0e49\u0e04\u0e37\u0e2d <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-607\" src=\"https:\/\/www.oopsbox.com\/wp-content\/uploads\/MySQL-Recursive-CTE.png\" alt=\"\" width=\"702\" height=\"315\" srcset=\"https:\/\/www.oopsbox.com\/wp-content\/uploads\/MySQL-Recursive-CTE.png 702w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/MySQL-Recursive-CTE-300x135.png 300w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/MySQL-Recursive-CTE-700x314.png 700w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/p>\n<p>\u0e2a\u0e21\u0e21\u0e38\u0e15\u0e34\u0e40\u0e23\u0e32\u0e21\u0e35\u0e42\u0e08\u0e17\u0e22\u0e4c\u0e15\u0e32\u0e21\u0e02\u0e49\u0e32\u0e07\u0e15\u0e49\u0e19 \u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e15\u0e32\u0e23\u0e32\u0e07\u0e0a\u0e31\u0e48\u0e27\u0e04\u0e23\u0e32\u0e27\u0e17\u0e35\u0e48\u0e40\u0e01\u0e47\u0e1a sequence number \u0e08\u0e32\u0e01 1 \u0e16\u0e36\u0e07 100 \u0e40\u0e23\u0e32\u0e01\u0e47\u0e40\u0e02\u0e35\u0e22\u0e19\u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">WITH RECURSIVE numbers AS (\r\n    SELECT 1 AS value\r\n    UNION ALL\r\n    SELECT value + 1 AS value\r\n    FROM numbers\r\n    WHERE numbers.value &lt; 100\r\n)\r\nSELECT *\r\nFROM numbers;<\/pre>\n<p>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e01\u0e47\u0e15\u0e32\u0e21\u0e19\u0e35\u0e49 \u0e14\u0e39\u0e44\u0e14\u0e49\u0e43\u0e19 <a href=\"https:\/\/dbfiddle.uk\/?rdbms=mariadb_10.3&amp;fiddle=d79c419118a2aaaaf9bce599f16b5929\">dbfiddle<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-790\" src=\"https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20190507232154-932x465.png\" alt=\"\" width=\"932\" height=\"465\" srcset=\"https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20190507232154-932x465.png 932w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20190507232154-932x465-300x150.png 300w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20190507232154-932x465-768x383.png 768w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20190507232154-932x465-700x349.png 700w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/p>\n<p>\u0e2a\u0e31\u0e49\u0e19 \u0e46 \u0e41\u0e25\u0e30\u0e07\u0e48\u0e32\u0e22\u0e43\u0e0a\u0e48\u0e44\u0e2b\u0e21 \u0e2d\u0e48\u0e32\u0e19\u0e08\u0e1a\u0e15\u0e32\u0e21\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u00a0 <a href=\"https:\/\/mariadb.com\/kb\/en\/library\/sequence-overview\/\">sequence<\/a> \u0e15\u0e48\u0e2d \u0e41\u0e19\u0e30\u0e19\u0e33\u0e40\u0e25\u0e22<br \/>\n\u0e2b\u0e25\u0e31\u0e1a\u0e1d\u0e31\u0e19\u0e14\u0e35\u0e21\u0e35\u0e41\u0e2e\u0e07 ^__^<\/p>\n<div id=\"s-share-buttons\" class=\"\"><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fb-share-button\" data-href=\"https:\/\/www.oopsbox.com\/?p=789\" data-type=\"button_count\"><\/div><\/div><div class=\"s-single-share\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\"><\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t<\/div><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"g-plusone\" data-size=\"medium\"><\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\/\/www.pinterest.com\/pin\/create\/button\/\" data-pin-do=\"buttonBookmark\"  data-pin-color=\"red\"><img decoding=\"async\" src=\"\/\/assets.pinterest.com\/images\/pidgets\/pinit_fg_en_rect_red_20.png\" \/><\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<script type=\"text\/javascript\" async defer src=\"\/\/assets.pinterest.com\/js\/pinit.js\"><\/script>\n\t\t\t\t\t\t\t\t\t\t\t\t<\/div><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"mailto:?Subject=MySQL%20generates%20a%20sequence%20of%20numeric%20values&Body=Here%20is%20the%20link%20to%20the%20article:%20https:\/\/www.oopsbox.com\/?p=789\" title=\"Email\" class=\"s3-email\"><img decoding=\"async\" src=\"https:\/\/www.oopsbox.com\/wp-content\/plugins\/simple-social-share\/includes\/..\/images\/share-email.png\"><\/a>\n\t\t\t\t\t\t\t\t\t\t\t<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\u0e2b\u0e25\u0e31\u0e07\u0e08\u0e32\u0e01\u0e44\u0e14\u0e49\u0e2d\u0e48\u0e32\u0e19\u0e41\u0e25\u0e30\u0e25\u0e2d\u0e07 Sequence \u0e43\u0e19 MariaDB 10.3 \u0e41\u0e25\u0e49\u0e27 \u0e21\u0e31\u0e19\u0e0a\u0e48\u0e32\u0e07\u0e07\u0e48\u0e32\u0e22\u0e40\u0e2b\u0e25\u0e37\u0e2d\u0e40\u0e01\u0e34\u0e19\u0e43\u0e2b\u0e49\u0e15\u0e32\u0e22\u0e40\u0e16\u0e2d\u0e30\u0e42\u0e23\u0e1a\u0e34\u0e19 (\u0e41\u0e19\u0e30\u0e19\u0e33\u0e43\u0e2b\u0e49\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u0e22\u0e31\u0e07\u0e44\u0e07\u0e01\u0e47\u0e44\u0e14\u0e49\u0e43\u0e0a\u0e49\u0e41\u0e19\u0e48 \u0e46 ) \u0e41\u0e15\u0e48\u0e1a\u0e25\u0e4a\u0e2d\u0e01\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e08\u0e30\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e19\u0e35\u0e49 5555 \u0e40\u0e23\u0e32\u0e08\u0e30\u0e43\u0e0a\u0e49\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48\u0e40\u0e23\u0e35\u0e22\u0e01\u0e27\u0e48\u0e32 CTE (Common Table Expression) \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e0a\u0e38\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 CTE \u0e0b\u0e36\u0e48\u0e07\u0e40\u0e23\u0e34\u0e48\u0e21\u0e43\u0e0a\u0e49\u0e44\u0e14\u0e49\u0e43\u0e19 MySQL 8.0, MariaDB 10.2 \u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e19\u0e21\u0e32\u0e0b\u0e36\u0e48\u0e07\u0e40\u0e2d\u0e32\u0e08\u0e23\u0e34\u0e07 \u0e46 \u0e01\u0e47\u0e07\u0e48\u0e32\u0e22\u0e1e\u0e2d \u0e46 \u0e01\u0e31\u0e19\u0e41\u0e2b\u0e25\u0e48\u0e30 \u0e40\u0e23\u0e32\u0e40\u0e04\u0e22\u0e40\u0e02\u0e35\u0e22\u0e19\u0e43\u0e19\u0e1a\u0e17\u0e04\u0e27\u0e32\u0e21\u0e40\u0e01\u0e48\u0e32 \u0e46 \u0e25\u0e2d\u0e07\u0e44\u0e1b\u0e2b\u0e32\u0e2d\u0e48\u0e32\u0e19\u0e01\u0e31\u0e19\u0e44\u0e14\u0e49 \u0e2b\u0e23\u0e37\u0e2d\u0e02\u0e2d\u0e07 \u0e2d.\u0e1b\u0e23\u0e30\u0e40\u0e2a\u0e23\u0e34\u0e10 \u0e25\u0e31\u0e01\u0e29\u0e13\u0e02\u0e2d\u0e07 CTE \u0e43\u0e0a\u0e49\u0e01\u0e32\u0e23\u0e40\u0e23\u0e35\u0e22\u0e01\u0e42\u0e14\u0e22\u0e27\u0e34\u0e18\u0e35 Recursive \u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e43\u0e19 MySQL \u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e41\u0e1a\u0e1a\u0e19\u0e35\u0e49 with_clause: WITH [RECURSIVE] cte_name [(col_name [, col_name] &#8230;)] AS (subquery) [, cte_name [(col_name [, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.oopsbox.com\/?p=789\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MySQL generates a sequence of numeric values&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":791,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[64,12,98],"class_list":["post-789","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-note","tag-cte","tag-mysql","tag-sequence-number","entry"],"views":2585,"_links":{"self":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts\/789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=789"}],"version-history":[{"count":1,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions"}],"predecessor-version":[{"id":792,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions\/792"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/media\/791"}],"wp:attachment":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}