{"id":6027,"date":"2024-08-01T22:46:28","date_gmt":"2024-08-01T14:46:28","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=6027"},"modified":"2024-08-02T16:20:11","modified_gmt":"2024-08-02T08:20:11","slug":"sql-%e6%89%a7%e8%a1%8c%e9%a1%ba%e5%ba%8f%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/sql-%e6%89%a7%e8%a1%8c%e9%a1%ba%e5%ba%8f%e8%af%a6%e8%a7%a3\/","title":{"rendered":"SQL \u6267\u884c\u987a\u5e8f\u8be6\u89e3"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<section style=\"font-size: 16px; padding-right: 10px; padding-left: 10px; word-break: break-word; text-align: left; line-height: 1.75; color: #595959; letter-spacing: 2px; background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.05) 3%, rgba(0, 0, 0, 0) 3%), linear-gradient(360deg, rgba(50, 0, 0, 0.05) 3%, rgba(0, 0, 0, 0) 3%); background-size: 20px 20px; background-position: center center; font-family: Roboto, Oxygen, Ubuntu, Cantarell, PingFangSC-light, PingFangTC-light, 'Open Sans', 'Helvetica Neue', sans-serif;\" data-tool=\"markdown2wechat\u7f16\u8f91\u5668\" data-website=\"https:\/\/aizhuanqian.com\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\ud83d\udc4b \u70ed\u7231\u7f16\u7a0b\u7684\u5c0f\u4f19\u4f34\u4eec\uff0c\u6b22\u8fce\u6765\u5230\u6211\u7684\u7f16\u7a0b\u6280\u672f\u5206\u4eab\u516c\u4f17\u53f7\uff01\u5728\u8fd9\u91cc\uff0c\u6211\u4f1a\u5206\u4eab\u7f16\u7a0b\u6280\u5de7\u3001\u5b9e\u6218\u7ecf\u9a8c\u3001\u6280\u672f\u5e72\u8d27\uff0c\u8fd8\u6709\u5404\u79cd\u6709\u8da3\u7684\u7f16\u7a0b\u8bdd\u9898\uff01<\/p>\n<section class=\"mp_profile_iframe_wrp\"><\/section>\n<blockquote style=\"font-size: 0.9em; overflow: auto; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; text-size-adjust: 100%; line-height: 1.55em; border-radius: 6px; color: #595959; box-sizing: inherit; border-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-color: #dec6fb; background: #f6eeff;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><p><span style=\"color: #dec6fb; font-size: 34px; line-height: 1; font-weight: bold;\">\u275d<\/span><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; font-size: 14px; word-spacing: 2px; line-height: 26px;\">\u5728\u4f7f\u7528 SQL \u8fdb\u884c\u6570\u636e\u5e93\u67e5\u8be2\u65f6\uff0c\u7406\u89e3 SQL \u8bed\u53e5\u7684\u6267\u884c\u987a\u5e8f\u81f3\u5173\u91cd\u8981\u3002\u8fd9\u4e0d\u4ec5\u6709\u52a9\u4e8e\u7f16\u5199\u9ad8\u6548\u7684\u67e5\u8be2\uff0c\u8fd8\u80fd\u5e2e\u52a9\u8c03\u8bd5\u548c\u4f18\u5316\u67e5\u8be2\u6027\u80fd\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd SQL \u8bed\u53e5\u7684\u6267\u884c\u987a\u5e8f\uff0c\u5e76\u901a\u8fc7\u793a\u4f8b\u4ee3\u7801\u52a0\u4ee5\u8bf4\u660e\u3002<\/p>\n<p><span style=\"float: right; color: #dec6fb;\">\u275e<\/span><\/p><\/blockquote>\n<h2 style=\"font-weight: bold; color: black; font-size: 22px; margin-top: 20px; margin-right: 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"font-size: 18px; display: inline-block; padding-left: 10px; border-left: 5px solid #dec6fb; color: #595959;\">SQL \u6267\u884c\u987a\u5e8f\u6982\u8ff0<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">SQL \u7684\u6267\u884c\u987a\u5e8f\u5e76\u4e0d\u603b\u662f\u6309\u7167\u6211\u4eec\u7f16\u5199 SQL \u8bed\u53e5\u7684\u987a\u5e8f\u8fdb\u884c\uff0c\u800c\u662f\u6709\u5176\u7279\u5b9a\u7684\u903b\u8f91\u987a\u5e8f\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0cSQL \u67e5\u8be2\u7684\u6267\u884c\u987a\u5e8f\u5982\u4e0b\uff1a<\/p>\n<ol class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; font-size: 15px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">FROM<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">WHERE<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">GROUP BY<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">HAVING<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">SELECT<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">DISTINCT<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">ORDER BY<\/strong><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; font-size: 14px;\"><strong style=\"color: #916dd5;\">LIMIT<\/strong><\/section>\n<\/li>\n<\/ol>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u6211\u4eec\u5c06\u9010\u6b65\u89e3\u6790\u6bcf\u4e2a\u6b65\u9aa4\uff0c\u5e76\u901a\u8fc7\u793a\u4f8b\u4ee3\u7801\u8fdb\u884c\u8bf4\u660e\u3002<\/p>\n<h2 style=\"font-weight: bold; color: black; font-size: 22px; margin-top: 20px; margin-right: 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"font-size: 18px; display: inline-block; padding-left: 10px; border-left: 5px solid #dec6fb; color: #595959;\">1. FROM<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5;\">FROM<\/code> \u5b50\u53e5\u662f SQL \u67e5\u8be2\u7684\u8d77\u70b9\u3002\u5b83\u6307\u5b9a\u4e86\u67e5\u8be2\u6570\u636e\u7684\u8868\u6216\u89c6\u56fe\u3002\u5728\u8fd9\u4e2a\u9636\u6bb5\uff0cSQL \u5f15\u64ce\u4f1a\u6839\u636e <code style=\"padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5;\">FROM<\/code> \u5b50\u53e5\u4e2d\u7684\u8868\u540d\u8bfb\u53d6\u6570\u636e\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">SELECT\ndepartment,\nCOUNT(*) \nFROM\nemployees \nWHERE\ndepartment IS NOT NULL \nGROUP BY\ndepartment \nHAVING\nCOUNT(*)&gt; 10O RDERBY COUNT(*) DESC \nLIMIT 5;\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u67e5\u8be2\u7ed3\u679c\u8fd4\u56de\u524d\u4e94\u4e2a\u90e8\u95e8\u3002<\/p>\n<h2 style=\"font-weight: bold; color: black; font-size: 22px; margin-top: 20px; margin-right: 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"font-size: 18px; display: inline-block; padding-left: 10px; border-left: 5px solid #dec6fb; color: #595959;\">\u7ed3\u8bed<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u7406\u89e3 SQL \u6267\u884c\u987a\u5e8f\u5bf9\u4e8e\u7f16\u5199\u9ad8\u6548\u7684\u67e5\u8be2\u548c\u4f18\u5316\u6570\u636e\u5e93\u6027\u80fd\u81f3\u5173\u91cd\u8981\u3002\u901a\u8fc7\u6309\u6b65\u9aa4\u89e3\u6790 SQL \u67e5\u8be2\u7684\u6267\u884c\u8fc7\u7a0b\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u7406\u89e3 SQL \u67e5\u8be2\u7684\u884c\u4e3a\u5e76\u8fdb\u884c\u4f18\u5316\u3002<\/p>\n<hr style=\"margin-top: 10px; margin-bottom: 10px; height: 1px; border-right: none; border-bottom: none; border-left: none; border-top: 2px solid #d9b8fa;\" data-tool=\"mdnice\u7f16\u8f91\u5668\" \/>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; margin-top: 10px; margin-bottom: 10px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u4e2a\u4eba\u89c2\u70b9\uff0c\u4ec5\u4f9b\u53c2\u8003\uff0c\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5982\u6709\u95ee\u9898\uff0c\u6b22\u8fce\u7559\u8a00\u8ba8\u8bba\u3002<\/p>\n<\/section>\n<p style=\"display: none;\">\n<blockquote><p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7: \u6e90\u8bdd\u7f16\u7a0b<\/p><\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc4b \u70ed\u7231\u7f16\u7a0b\u7684\u5c0f\u4f19\u4f34\u4eec\uff0c\u6b22\u8fce\u6765\u5230\u6211\u7684\u7f16\u7a0b\u6280\u672f\u5206\u4eab\u516c\u4f17\u53f7\uff01\u5728\u8fd9\u91cc\uff0c\u6211\u4f1a\u5206\u4eab\u7f16\u7a0b\u6280\u5de7\u3001\u5b9e\u6218\u7ecf\u9a8c\u3001\u6280\u672f\u5e72\u8d27\uff0c\u8fd8\u6709\u5404\u79cd\u6709\u8da3\u7684\u7f16\u7a0b\u8bdd\u9898\uff01 \u275d &#8230;<\/p>\n","protected":false},"author":1,"featured_media":6013,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7,34],"tags":[],"class_list":["post-6027","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot","category-34"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223412704-150x150.jpeg","content_first_image":null,"post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223412704-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223412704.jpeg","post_frist_image":null,"post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223412704-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223412704.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801223412704.jpeg","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2024-08-01","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":380,"next_post_id":5837,"next_post_title":"Spring Boot\u9879\u76eepom.xml\u4e2d\u7684${project.basedir}\u53d8\u91cf\u7528\u6cd5\u6574\u7406","previous_post_id":5833,"previous_post_title":"\u5982\u4f55\u5728Spring\u4e2d\u901a\u8fc7\u81ea\u5b9a\u4e49\u6ce8\u89e3EnumValue\u6821\u9a8c\u679a\u4e3e\u503c","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=6027"}],"version-history":[{"count":2,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6027\/revisions"}],"predecessor-version":[{"id":6448,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6027\/revisions\/6448"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/6013"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=6027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=6027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=6027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}