{"id":726,"date":"2021-12-06T22:38:01","date_gmt":"2021-12-06T14:38:01","guid":{"rendered":"https:\/\/www.dataisfun.cn\/?p=726"},"modified":"2021-12-13T15:54:48","modified_gmt":"2021-12-13T07:54:48","slug":"tn%e7%95%99%e5%ad%98%e7%8e%87","status":"publish","type":"post","link":"https:\/\/www.dataisfun.cn\/?p=726","title":{"rendered":"SQL-\u7ecf\u5178\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86 <a href=\"https:\/\/www.dataisfun.cn\/?p=564\" target=\"_blank\" rel=\"noreferrer noopener\">\u8fde\u7eed\u767b\u5f55<\/a>\u3001<a href=\"https:\/\/www.dataisfun.cn\/?p=566\" target=\"_blank\" rel=\"noreferrer noopener\">TOP N<\/a>\u3001<a href=\"https:\/\/www.dataisfun.cn\/?p=637\" target=\"_blank\" rel=\"noreferrer noopener\">\u73af\u6bd4\u540c\u6bd4<\/a> \u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684<span class=\"has-inline-color has-vivid-cyan-blue-color\">T+N\u6307\u6807<\/span>\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u3001T+N\u590d\u501f\u7387 \u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u5047\u8bbe\u6211\u4eec\u5df2\u6709<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">\u6ce8\u518c\u8868register_detail<\/span><\/strong>\u548c<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">\u767b\u5f55\u8868login_detail<\/span><\/strong>\uff0c\u6211\u4eec\u8981\u6309\u6ce8\u518c\u6708\u4efd\u7edf\u8ba1T+1\u6ce8\u518c\u767b\u5f55\u7387\u3001T+3\u6ce8\u518c\u767b\u5f55\u7387\u3001T+7\u6ce8\u518c\u767b\u5f55\u7387\u3002<\/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\/12\/TN\u6307\u6807-1.png\" alt=\"\" class=\"wp-image-744\" width=\"184\" height=\"323\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-1.png 368w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-1-171x300.png 171w\" sizes=\"auto, (max-width: 184px) 100vw, 184px\" \/><\/figure>\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\/12\/TN\u6307\u6807-2.png\" alt=\"\" class=\"wp-image-745\" width=\"184\" height=\"835\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-2.png 368w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-2-66x300.png 66w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-2-226x1024.png 226w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-2-339x1536.png 339w\" sizes=\"auto, (max-width: 184px) 100vw, 184px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u793a\u4f8b\u4ee3\u7801\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=\"\">--01\uff1a\u6ce8\u518c\ndrop table if exists tmp1;\ncreate table tmp1 as\nselect\n    cust_id,\n    register_time,\n    date(register_time) as register_date,\n    to_char(register_time,'yyyymm') as register_month\nfrom register_detail;\n\n\n--02\uff1a\u767b\u5f55\ndrop table if exists tmp2;\ncreate table tmp2 as\nselect\n    cust_id,\n    date(login_time) as login_date\nfrom login_detail\ngroup by 1,2;\n\n\n--03\uff1a\u5339\u914d\u6253\u6807\u7b7e\ndrop table if exists tmp3;\ncreate table tmp3 as\nselect\n    t1.cust_id,\n    max(case when t2.login_date = t1.register_date + interval '1' day then 1 else 0 end) as is_login_t1,\n    max(case when t2.login_date = t1.register_date + interval '3' day then 1 else 0 end) as is_login_t3,\n    max(case when t2.login_date = t1.register_date + interval '7' day then 1 else 0 end) as is_login_t7\nfrom tmp1 as t1\nleft join tmp2 as t2\non t1.cust_id = t2.cust_id and t2.login_date > t1.register_date and t2.login_date &lt;= t1.register_date + interval '7' day\ngroup by 1;\n\n\n--04\uff1a\u53cd\u5339\u5e76\u6309\u9700\u5904\u7406\ndrop table if exists tmp4;\ncreate table tmp4 as\nselect\n    t1.cust_id,\n    t1.register_time,\n    t1.register_date,\n    t1.register_month,\n    coalesce(t2.is_login_t1, 0) as is_login_t1,\n    coalesce(t2.is_login_t3, 0) as is_login_t3,\n    coalesce(t2.is_login_t7, 0) as is_login_t7\nfrom tmp1 as t1\nleft join tmp3 as t2\non t1.cust_id = t2.cust_id;\n\n\n--05\uff1a\u6309\u6ce8\u518c\u6708\u4efd\u6c47\u603b\u7edf\u8ba1\ndrop table if exists tmp5;\ncreate table tmp5 as\nselect\n    register_month,\n    register_cnt_t1,\n    register_login_cnt_t1,\n    register_cnt_t3,\n    register_login_cnt_t3,\n    register_cnt_t7,\n    register_login_cnt_t7,\n    register_login_cnt_t1*1.0000\/register_cnt_t1 as register_login_rate_t1,\n    register_login_cnt_t3*1.0000\/register_cnt_t3 as register_login_rate_t3,\n    register_login_cnt_t7*1.0000\/register_cnt_t7 as register_login_rate_t7\nfrom (\n    select\n        register_month,\n        \n        sum(case when register_date &lt; current_date - interval '1' day then 1 else 0 end) as register_cnt_t1,  --\u6ce8\u610f\u5206\u6bcd\u8981\u9650\u65f6\u95f4\u7a97\u53e3\n        sum(case when register_date &lt; current_date - interval '1' day then is_login_t1 end) as register_login_cnt_t1,  --\u6ce8\u610f\u5206\u5b50\u8981\u9650\u65f6\u95f4\u7a97\u53e3\n        \n        sum(case when register_date &lt; current_date - interval '3' day then 1 else 0 end) as register_cnt_t3,\n        sum(case when register_date &lt; current_date - interval '3' day then is_login_t3 end) as register_login_cnt_t3,\n        \n        sum(case when register_date &lt; current_date - interval '7' day then 1 else 0 end) as register_cnt_t7,\n        sum(case when register_date &lt; current_date - interval '7' day then is_login_t7 end) as register_login_cnt_t7\n    from tmp4\n    group by 1\n) as t;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u4ee3\u7801\u7ed3\u679c\uff1a<\/strong><\/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\/12\/TN\u6307\u6807-3.png\" alt=\"\" class=\"wp-image-746\" width=\"552\" height=\"323\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-3.png 1103w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-3-300x176.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-3-1024x600.png 1024w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-3-768x450.png 768w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-3-512x300.png 512w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><\/figure>\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\/12\/TN\u6307\u6807-5.png\" alt=\"\" class=\"wp-image-748\" width=\"1136\" height=\"98\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5.png 2271w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5-300x26.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5-1024x88.png 1024w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5-768x66.png 768w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5-1536x133.png 1536w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5-2048x177.png 2048w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/12\/TN\u6307\u6807-5-850x73.png 850w\" sizes=\"auto, (max-width: 1136px) 100vw, 1136px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u4ee5\u4e0a\u5c31\u662fT+N\u6ce8\u518c\u767b\u5f55\u7387\u7684\u5206\u6b65\u4ee3\u7801\uff0c\u4f7f\u7528Presto SQL\u6267\u884c\uff0c\u5176\u4ed6SQL\u5728\u65e5\u671f\u65f6\u95f4\u7684\u5904\u7406\u4e0a\u53ef\u80fd\u4f1a\u6709\u6240\u5dee\u5f02\u3002\u9700\u8981\u5f3a\u8c03\u7684\u662f\u4ee3\u7801\u4e2d\u7684\u7b2c5\u6b65\uff0cT+N\u6307\u6807\u7684\u8ba1\u7b97\u9700\u8981\u6ce8\u610f\u9690\u542b\u7684\u65f6\u95f4\u7a97\u53e3\u6761\u4ef6\uff0c\u5206\u5b50\u8981\u6ee1\u8db3T+N\u7684\u6761\u4ef6\uff0c\u5206\u6bcd\u4e5f\u8981\u6ee1\u8db3N\u7684\u7a97\u53e3\uff0c\u5c31\u662f\u8bf4\u6211\u4eec\u8981\u8ba1\u7b97T+3\u6ce8\u518c\u767b\u5f55\u7387\uff0c\u5206\u6bcd\u5e94\u8be5\u662f\u5df2\u7ecf\u6ce8\u518c\u8fbe\u52303\u5929\u7684\u5ba2\u6237\uff0c\u521a\u6ce8\u518c1\u5929\u7684\u5ba2\u6237\uff0c\u5176\u53cd\u5e94\u5468\u671f\u8fd8\u4e0d\u8db33\u5929\uff0c\u4e0d\u5e94\u8be5\u4f5c\u4e3a\u5206\u6bcd\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u5176\u4ed6\u8bf8\u5982 T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u3001T+N\u590d\u501f\u7387 \u5176\u5e95\u5c42\u5904\u7406\u903b\u8f91\u90fd\u5dee\u4e0d\u591a\uff0c\u53c2\u8003\u4e0a\u8ff0\u4ee3\u7801\u6309\u9700\u8c03\u6574\u5373\u53ef\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>\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86 \u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4 \u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0&hellip; <a href=\"https:\/\/www.dataisfun.cn\/?p=726\" class=\"more-link read-more\" rel=\"bookmark\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">SQL-\u7ecf\u5178\u7684T+N\u6307\u6807\u8ba1\u7b97\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":[6],"class_list":["post-726","post","type-post","status-publish","format-standard","hentry","category-sql","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>T+N\u7559\u5b58\u7387 | SQL T+N\u7559\u5b58\u7387 | SQL T+N\u8f6c\u5316\u7387 - \u6570\u636e\u597d\u73a9<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86\u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4\u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \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=726\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"T+N\u7559\u5b58\u7387 | SQL T+N\u7559\u5b58\u7387 | SQL T+N\u8f6c\u5316\u7387 - \u6570\u636e\u597d\u73a9\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86\u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4\u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dataisfun.cn\/?p=726\" \/>\n<meta property=\"og:site_name\" content=\"\u6570\u636e\u597d\u73a9\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-06T14:38:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-13T07:54:48+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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dataisfun.cn\/?p=726\",\"url\":\"https:\/\/www.dataisfun.cn\/?p=726\",\"name\":\"T+N\u7559\u5b58\u7387 | SQL T+N\u7559\u5b58\u7387 | SQL T+N\u8f6c\u5316\u7387 - \u6570\u636e\u597d\u73a9\",\"isPartOf\":{\"@id\":\"https:\/\/www.dataisfun.cn\/#website\"},\"datePublished\":\"2021-12-06T14:38:01+00:00\",\"dateModified\":\"2021-12-13T07:54:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293\"},\"description\":\"\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86\u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4\u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dataisfun.cn\/?p=726#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dataisfun.cn\/?p=726\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dataisfun.cn\/?p=726#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.dataisfun.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL-\u7ecf\u5178\u7684T+N\u6307\u6807\u8ba1\u7b97\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":"T+N\u7559\u5b58\u7387 | SQL T+N\u7559\u5b58\u7387 | SQL T+N\u8f6c\u5316\u7387 - \u6570\u636e\u597d\u73a9","description":"\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86\u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4\u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \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=726","og_locale":"zh_CN","og_type":"article","og_title":"T+N\u7559\u5b58\u7387 | SQL T+N\u7559\u5b58\u7387 | SQL T+N\u8f6c\u5316\u7387 - \u6570\u636e\u597d\u73a9","og_description":"\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86\u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4\u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \u3002","og_url":"https:\/\/www.dataisfun.cn\/?p=726","og_site_name":"\u6570\u636e\u597d\u73a9","article_published_time":"2021-12-06T14:38:01+00:00","article_modified_time":"2021-12-13T07:54:48+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.dataisfun.cn\/?p=726","url":"https:\/\/www.dataisfun.cn\/?p=726","name":"T+N\u7559\u5b58\u7387 | SQL T+N\u7559\u5b58\u7387 | SQL T+N\u8f6c\u5316\u7387 - \u6570\u636e\u597d\u73a9","isPartOf":{"@id":"https:\/\/www.dataisfun.cn\/#website"},"datePublished":"2021-12-06T14:38:01+00:00","dateModified":"2021-12-13T07:54:48+00:00","author":{"@id":"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293"},"description":"\u5173\u4e8eSQL\u7684\u7ecf\u5178\u53d6\u6570\u95ee\u9898\uff0c\u6211\u4eec\u5df2\u7ecf\u68b3\u7406\u4e86\u8fde\u7eed\u767b\u5f55\u3001TOP N\u3001\u73af\u6bd4\u540c\u6bd4\u7b49\u95ee\u9898\u7684\u53d6\u6570\u903b\u8f91\u548c\u4ee3\u7801\u5b9e\u73b0\uff0c\u672c\u6587\u7ee7\u7eed\u603b\u7ed3\u6570\u636e\u5206\u6790\u4e2d\u5fc5\u7528\u7684T+N\u6307\u6807\u8ba1\u7b97\u95ee\u9898\u3002\u5e38\u89c1\u7684T+N\u6307\u6807\u6709 T+N\u7559\u5b58\u7387 \u3001T+N\u8f6c\u5316\u7387\u3001T+N\u903e\u671f\u7387\u7b49\uff0c\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c31\u4ee5\u5e38\u89c1\u7684\u6ce8\u518c\u53ca\u767b\u5f55\u4e3a\u4f8b\uff0c\u8ba1\u7b97\u6ce8\u518c\u5ba2\u6237\u7684 T+N\u7559\u5b58\u7387 \u3002","breadcrumb":{"@id":"https:\/\/www.dataisfun.cn\/?p=726#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dataisfun.cn\/?p=726"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dataisfun.cn\/?p=726#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.dataisfun.cn\/"},{"@type":"ListItem","position":2,"name":"SQL-\u7ecf\u5178\u7684T+N\u6307\u6807\u8ba1\u7b97\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\/726","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=726"}],"version-history":[{"count":12,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/726\/revisions"}],"predecessor-version":[{"id":765,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/726\/revisions\/765"}],"wp:attachment":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}