{"id":393,"date":"2021-10-05T11:10:26","date_gmt":"2021-10-05T03:10:26","guid":{"rendered":"https:\/\/www.dataisfun.cn\/?p=393"},"modified":"2021-12-13T15:46:34","modified_gmt":"2021-12-13T07:46:34","slug":"sql%e8%a1%8c%e5%88%97%e8%bd%ac%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/www.dataisfun.cn\/?p=393","title":{"rendered":"SQL-\u7ecf\u5178\u7684\u884c\u5217\u8f6c\u6362\u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"font-size:12px\"><li>\u884c\u8f6c\u5217\uff1a\u7531\u884c\u53d8\u6210\u5217\uff0c\u884c\u53d8\u5c11\u5217\u53d8\u591a<\/li><li>\u5217\u8f6c\u884c\uff1a\u7531\u5217\u53d8\u6210\u884c\uff0c\u5217\u53d8\u5c11\u884c\u53d8\u591a<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u6c47\u603b\u8868(\u4e0d\u91cd\u590d)\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88683-1024x360.png\" alt=\"\" class=\"wp-image-450\" width=\"512\" height=\"180\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88683-1024x360.png 1024w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88683-300x106.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88683-768x270.png 768w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88683-850x300.png 850w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88683.png 1071w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color wp-block-paragraph\" style=\"font-size:12px\"> <strong>table1 \u2192 table2 \u884c\u8f6c\u5217\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--\u884c\u8f6c\u5217_\u4f7f\u7528case when\u5b9e\u73b0\nselect\n\tcust_id,\n\tsum(case when product = '\u6c34\u679c' then amount end) as fruit,\n\tsum(case when product = '\u725b\u5976' then amount end) as milk,\n\tsum(case when product = '\u96f6\u98df' then amount end) as snack\nfrom table1\ngroup by 1;\n\n\n--\u884c\u8f6c\u5217_\u4f7f\u7528map\u5b9e\u73b0\nselect\n\tcust_id,\n\tkv['\u6c34\u679c'] as fruit,\n\tkv['\u725b\u5976'] as milk,\n\tkv['\u96f6\u98df'] as snack\nfrom (\n\tselect\n\t\tcust_id,\n\t\tmap_agg(product, amount) as kv\n\tfrom table1\n\tgroup by 1\n\t);<\/pre>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color wp-block-paragraph\" style=\"font-size:12px\"> <strong>table2 \u2192 table1 \u5217\u8f6c\u884c\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--\u5217\u8f6c\u884c_\u4f7f\u7528cross join unnest\u5b9e\u73b0\nselect\n\tcust_id,\n\tproduct,\n\tamount\nfrom table2\ncross join unnest(\n\tarray['fruit', 'milk', 'snack'],\n\tarray[fruit, milk, snack]\n\t) as t (product, amount);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u4ee5\u4e0a\u7684\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u5373\u662f\u6211\u4eec\u901a\u5e38\u6240\u8bf4\u7684\u884c\u5217\u8f6c\u6362\uff0c\u4e0d\u8fc7\u5b9e\u9645\u53d6\u6570\u4e2d\u8fd8\u6709\u4e00\u79cd&#8221;\u5217\u8f6c\u884c&#8221;-\u5c06\u5355\u884c\u5185\u5bb9\u8f6c\u6210\u591a\u884c\u5185\u5bb9\uff0c\u8fd9\u662f\u56e0\u4e3a\u6e90\u8868\u5728\u5b58\u50a8\u6570\u636e\u65f6\u5c06\u6570\u636e\u5408\u5e76\u5b58\u50a8\u4e86\u3002 \u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table3 \u548c table4 \u4e24\u5f20\u8868\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88685.png\" alt=\"\" class=\"wp-image-479\" width=\"322\" height=\"216\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88685.png 643w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88685-300x202.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u884c\u5217\u8f6c\u6362\u88685-447x300.png 447w\" sizes=\"auto, (max-width: 322px) 100vw, 322px\" \/><\/figure>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color wp-block-paragraph\" style=\"font-size:12px\"><strong>table3 \u2192 table4 \u5355\u884c\u8f6c\u591a\u884c\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--\u5355\u884c\u8f6c\u591a\u884c_\u4f7f\u7528cross join unnest\u5b9e\u73b0\nselect\n    cust_id,\n    amount_split as amount\nfrom table3\ncross join unnest(split(amount, ',')) as t (amount_split);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><br>\u5bf9\u4e8e\u4e1a\u52a1\u56fa\u5316\u7684\u62a5\u8868\u800c\u8a00\uff0c\u65e0\u8bba\u662f\u884c\u8f6c\u5217\u8fd8\u662f\u5217\u8f6c\u884c\uff0c\u90fd\u662f\u5fc5\u8981\u7684\u3002\u4f46\u5bf9\u4e8e\u5206\u6790\u800c\u8a00\uff0c\u591a\u7ef4\u5ea6\u6c47\u603b\u8868\u4fdd\u7559\u7684\u4fe1\u606f\u91cf\u66f4\u591a\u3001\u4f38\u7f29\u6027\u6269\u5c55\u6027\u66f4\u5f3a\uff0c\u5728\u53d6\u6570\u8fc7\u7a0b\u4e2d\uff0c\u884c\u8f6c\u5217\u662f\u4e0d\u5fc5\u8981\u7684\uff0c\u5217\u8f6c\u884c\u662f\u5fc5\u8981\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u5728SQL\u4e2d\u8dd1\u51fa\u591a\u7ef4\u5ea6\u6c47\u603b\u7684\u6e90\u8868\u540e\uff0c\u7ee7\u7eed\u5728Excel\u4e2d\u6216\u8005\u5728Python\u4e2d\u505a\u5404\u79cd\u900f\u89c6\u5206\u6790\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><br><span class=\"sme-text-color has-cyan-bluish-gray-color\">\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u8f6c\u8f7d\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u5e76\u7559\u4e0b\u539f\u6587\u94fe\u63a5\u3002<\/span> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL&hellip; <a href=\"https:\/\/www.dataisfun.cn\/?p=393\" class=\"more-link read-more\" rel=\"bookmark\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">SQL-\u7ecf\u5178\u7684\u884c\u5217\u8f6c\u6362\u95ee\u9898<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[9,6],"class_list":["post-393","post","type-post","status-publish","format-standard","hentry","category-sql","tag-presto","tag-sql","h-entry","h-as-article"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.11 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL \u884c\u5217\u8f6c\u6362 | SQL \u884c\u8f6c\u5217 \u5217\u8f6c\u884c | Presto SQL \u884c\u5217\u8f6c\u6362 - \u6570\u636e\u597d\u73a9<\/title>\n<meta name=\"description\" content=\"\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u8868\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dataisfun.cn\/?p=393\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL \u884c\u5217\u8f6c\u6362 | SQL \u884c\u8f6c\u5217 \u5217\u8f6c\u884c | Presto SQL \u884c\u5217\u8f6c\u6362 - \u6570\u636e\u597d\u73a9\" \/>\n<meta property=\"og:description\" content=\"\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u8868\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dataisfun.cn\/?p=393\" \/>\n<meta property=\"og:site_name\" content=\"\u6570\u636e\u597d\u73a9\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-05T03:10:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-13T07:46:34+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dataisfun.cn\/?p=393\",\"url\":\"https:\/\/www.dataisfun.cn\/?p=393\",\"name\":\"SQL \u884c\u5217\u8f6c\u6362 | SQL \u884c\u8f6c\u5217 \u5217\u8f6c\u884c | Presto SQL \u884c\u5217\u8f6c\u6362 - \u6570\u636e\u597d\u73a9\",\"isPartOf\":{\"@id\":\"https:\/\/www.dataisfun.cn\/#website\"},\"datePublished\":\"2021-10-05T03:10:26+00:00\",\"dateModified\":\"2021-12-13T07:46:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293\"},\"description\":\"\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u8868\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dataisfun.cn\/?p=393#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dataisfun.cn\/?p=393\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dataisfun.cn\/?p=393#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.dataisfun.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL-\u7ecf\u5178\u7684\u884c\u5217\u8f6c\u6362\u95ee\u9898\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dataisfun.cn\/#website\",\"url\":\"https:\/\/www.dataisfun.cn\/\",\"name\":\"\u6570\u636e\u597d\u73a9\",\"description\":\"\u6570\u4e2d\u81ea\u6709\u4e7e\u5764\uff0c\u4e8e\u4e50\u8da3\u4e2d\u53d1\u73b0\u4ef7\u503c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dataisfun.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293\",\"name\":\"admin\",\"sameAs\":[\"http:\/\/www.dataisfun.cn\"],\"url\":\"https:\/\/www.dataisfun.cn\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL \u884c\u5217\u8f6c\u6362 | SQL \u884c\u8f6c\u5217 \u5217\u8f6c\u884c | Presto SQL \u884c\u5217\u8f6c\u6362 - \u6570\u636e\u597d\u73a9","description":"\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u8868\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dataisfun.cn\/?p=393","og_locale":"zh_CN","og_type":"article","og_title":"SQL \u884c\u5217\u8f6c\u6362 | SQL \u884c\u8f6c\u5217 \u5217\u8f6c\u884c | Presto SQL \u884c\u5217\u8f6c\u6362 - \u6570\u636e\u597d\u73a9","og_description":"\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u8868\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002","og_url":"https:\/\/www.dataisfun.cn\/?p=393","og_site_name":"\u6570\u636e\u597d\u73a9","article_published_time":"2021-10-05T03:10:26+00:00","article_modified_time":"2021-12-13T07:46:34+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.dataisfun.cn\/?p=393","url":"https:\/\/www.dataisfun.cn\/?p=393","name":"SQL \u884c\u5217\u8f6c\u6362 | SQL \u884c\u8f6c\u5217 \u5217\u8f6c\u884c | Presto SQL \u884c\u5217\u8f6c\u6362 - \u6570\u636e\u597d\u73a9","isPartOf":{"@id":"https:\/\/www.dataisfun.cn\/#website"},"datePublished":"2021-10-05T03:10:26+00:00","dateModified":"2021-12-13T07:46:34+00:00","author":{"@id":"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293"},"description":"\u884c\u5217\u8f6c\u6362\u662f\u6570\u636e\u5904\u7406\u4e2d\u5e38\u89c1\u7684\u64cd\u4f5c\uff0c\u65e5\u5e38\u62a5\u8868\u7ecf\u5e38\u9700\u8981\u6309\u7167\u4e1a\u52a1\u770b\u6570\u4e60\u60ef\u505a\u884c\u5217\u8f6c\u6362\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u603b\u7ed3\u4e00\u4e0bSQL\u884c\u5217\u8f6c\u6362\u7684\u5b9e\u73b0\u3002\u884c\u5217\u8f6c\u6362\u5305\u62ec\u884c\u8f6c\u5217\u548c\u5217\u8f6c\u884c\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b table1 \u548c table2 \u4e24\u5f20\u8868\uff0ctable1 \u2192 table2 \u5373\u4e3a\u884c\u8f6c\u5217\uff0ctable2 \u2192 table1 \u5373\u4e3a\u5217\u8f6c\u884c\uff0c\u6211\u4eec\u770b\u4e00\u4e0bPresto SQL\u884c\u8f6c\u5217\u3001\u5217\u8f6c\u884c\u7684\u5b9e\u73b0\u3002","breadcrumb":{"@id":"https:\/\/www.dataisfun.cn\/?p=393#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dataisfun.cn\/?p=393"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dataisfun.cn\/?p=393#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.dataisfun.cn\/"},{"@type":"ListItem","position":2,"name":"SQL-\u7ecf\u5178\u7684\u884c\u5217\u8f6c\u6362\u95ee\u9898"}]},{"@type":"WebSite","@id":"https:\/\/www.dataisfun.cn\/#website","url":"https:\/\/www.dataisfun.cn\/","name":"\u6570\u636e\u597d\u73a9","description":"\u6570\u4e2d\u81ea\u6709\u4e7e\u5764\uff0c\u4e8e\u4e50\u8da3\u4e2d\u53d1\u73b0\u4ef7\u503c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dataisfun.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293","name":"admin","sameAs":["http:\/\/www.dataisfun.cn"],"url":"https:\/\/www.dataisfun.cn\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=393"}],"version-history":[{"count":11,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/393\/revisions"}],"predecessor-version":[{"id":775,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/393\/revisions\/775"}],"wp:attachment":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}