{"id":441,"date":"2025-03-16T05:58:18","date_gmt":"2025-03-16T05:58:18","guid":{"rendered":"https:\/\/linuxjk.cn\/?p=441"},"modified":"2025-03-17T14:52:36","modified_gmt":"2025-03-17T14:52:36","slug":"%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8e%9f%e7%90%86%e8%bf%99%e9%97%a8%e8%af%be%e5%ae%9e%e9%aa%8c%e8%bf%87%e7%a8%8b%e9%81%87%e5%88%b0%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/linuxjk.cn\/?p=441","title":{"rendered":"\u6570\u636e\u5e93\u539f\u7406\u8fd9\u95e8\u8bfe\u5b9e\u9a8c\u8fc7\u7a0b\u9047\u5230\u7684\u95ee\u9898"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"441\" class=\"elementor elementor-441\">\n\t\t\t\t<div class=\"elementor-element elementor-element-f9272ac e-flex e-con-boxed e-con e-parent\" data-id=\"f9272ac\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8cbcf21 elementor-widget elementor-widget-text-editor\" data-id=\"8cbcf21\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>\u5e38\u89c1\u7684SQL\u6267\u884c\u987a\u5e8f\u662f\uff1aFROM -&gt; WHERE -&gt; GROUP BY -&gt; HAVING -&gt; SELECT -&gt; ORDER BY\u3002WHERE\u5b50\u53e5\u5728\u5206\u7ec4\u524d\u8fc7\u6ee4\u884c\uff0c\u800cHAVING\u5728\u5206\u7ec4\u540e\u8fc7\u6ee4\u7ec4\u3002<\/strong><br \/><strong>\u5728SELECT\u5b50\u53e5\u4e2d\u4f7f\u7528\u805a\u5408\u51fd\u6570\u65f6\uff0c\u901a\u5e38\u9700\u8981GROUP BY\u6765\u6307\u5b9a\u5206\u7ec4\u7684\u5217\u3002\u4f8b\u5982\uff0c\u6309\u5b66\u53f7\u5206\u7ec4\u540e\uff0c\u7edf\u8ba1\u6bcf\u4e2a\u5b66\u53f7\u7684\u9009\u8bfe\u6570\u91cf\uff0c\u8fd9\u6837HAVING\u5b50\u53e5\u624d\u80fd\u6b63\u786e\u8fc7\u6ee4\u51fa\u7b26\u5408\u6761\u4ef6\u7684\u7ec4\u3002<\/strong><br \/><strong>\u5173\u952e\u603b\u7ed3<\/strong><br \/><strong>\u805a\u5408\u6761\u4ef6\u7528 HAVING\uff1a\u6240\u6709\u6d89\u53ca COUNT\u3001SUM\u3001AVG \u7b49\u805a\u5408\u51fd\u6570\u7684\u6761\u4ef6\u5fc5\u987b\u653e\u5728 HAVING \u4e2d\u3002<\/strong><\/p><p><strong>\u5206\u7ec4\u5fc5\u7528 GROUP BY\uff1a\u5982\u679c\u67e5\u8be2\u4e2d\u5305\u542b\u805a\u5408\u51fd\u6570\u4e14\u9700\u8981\u5206\u7ec4\u7edf\u8ba1\uff0c\u5fc5\u987b\u663e\u5f0f\u4f7f\u7528 GROUP BY<\/strong><\/p><p><strong>&#8211;19.\u6c42\u9009\u4fee\u8bfe\u7a0b\u8d85\u8fc73\u95e8\u7684\u5b66\u751f\u5b66\u53f7<\/strong><br \/><strong>SELECT Sno<\/strong><br \/><strong>FROM SC<\/strong><br \/><strong>GROUP BY Sno<\/strong><br \/><strong>HAVING COUNT (Cno) &gt; 3;<\/strong><\/p><p><br \/><strong>\u5982\u679c\u67e5\u8be2\u9700\u8981\u540c\u65f6\u5305\u542b WHERE \u548c HAVING\uff0c\u4f8b\u5982\u201c\u9009\u4fee\u8d85\u8fc73\u95e8\u4e14\u6210\u7ee9\u5747\u5927\u4e8e80\u5206\u7684\u5b66\u751f\u5b66\u53f7\u201d\uff1a<\/strong><br \/><strong>SELECT Sno<\/strong><br \/><strong>FROM SC<\/strong><br \/><strong>WHERE Grade &gt; 80 &#8212; \u5148\u8fc7\u6ee4\u5355\u6761\u8bb0\u5f55<\/strong><br \/><strong>GROUP BY Sno<\/strong><br \/><strong>HAVING COUNT(Cno) &gt; 3; &#8212; \u518d\u8fc7\u6ee4\u5206\u7ec4\u7ed3\u679c<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-365146e elementor-widget elementor-widget-text-editor\" data-id=\"365146e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u8fd9\u662f\u793a\u4f8b\u6587\u672c\uff0c\u5355\u51fb \u201c\u7f16\u8f91\u201d \u6309\u94ae\u66f4\u6539\u6b64\u6587\u672c\u3002<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u5e38\u89c1\u7684SQL\u6267\u884c\u987a\u5e8f\u662f\uff1aFROM -&gt; WHERE -&gt; GROUP BY -&gt; HAVIN [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[12],"class_list":["post-441","post","type-post","status-publish","format-standard","hentry","category-vxhs888p","tag-study-note"],"_links":{"self":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=441"}],"version-history":[{"count":5,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/441\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}