{"id":27696,"date":"2024-11-24T12:19:53","date_gmt":"2024-11-24T04:19:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27696\/"},"modified":"2024-11-24T12:19:53","modified_gmt":"2024-11-24T04:19:53","slug":"mysql-%e7%bb%84%e5%90%88%e7%b4%a2%e5%bc%95%e4%b8%ba%e4%bd%95%e5%a4%b1%e6%95%88%ef%bc%9fselect-%e6%9f%a5%e8%af%a2%e4%b8%ba%e4%bd%95%e4%bc%9a%e9%98%bb%e7%a2%8d%e7%b4%a2%e5%bc%95-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27696\/","title":{"rendered":"MySQL \u7ec4\u5408\u7d22\u5f15\u4e3a\u4f55\u5931\u6548\uff1f\u201cSELECT *\u201d \u67e5\u8be2\u4e3a\u4f55\u4f1a\u963b\u788d\u7d22\u5f15\u7684\u4f7f\u7528\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173130652911480.jpg\" class=\"aligncenter\" title=\"MySQL \u7ec4\u5408\u7d22\u5f15\u4e3a\u4f55\u5931\u6548\uff1f\u201cSELECT *\u201d \u67e5\u8be2\u4e3a\u4f55\u4f1a\u963b\u788d\u7d22\u5f15\u7684\u4f7f\u7528\uff1f\u63d2\u56fe\" alt=\"MySQL \u7ec4\u5408\u7d22\u5f15\u4e3a\u4f55\u5931\u6548\uff1f\u201cSELECT *\u201d \u67e5\u8be2\u4e3a\u4f55\u4f1a\u963b\u788d\u7d22\u5f15\u7684\u4f7f\u7528\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u7ec4\u5408\u7d22\u5f15\u672a\u751f\u6548\u7684\u5206\u6790<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5bf9\u4e8e\u62e5\u6709\u4e3b\u952e A \u548c\u7ec4\u5408\u7d22\u5f15 B\u3001C \u7684\u8868\uff0c MySQL \u65e0\u6cd5\u5728\u67e5\u8be2\u8bed\u53e5 &#8220;SELECT * FROM Table where B=1 and C = 2&#8221; \u4e2d\u4f7f\u7528\u8be5\u7ec4\u5408\u7d22\u5f15\uff1f<\/p>\n<p><strong>\u5206\u6790\uff1a<\/strong><\/p>\n<p>\u867d\u7136 GPT \u58f0\u79f0\u8be5\u67e5\u8be2\u53ef\u4ee5\u4f7f\u7528\u7ec4\u5408\u7d22\u5f15\uff0c\u4f46\u5b9e\u9645\u60c5\u51b5\u5e76\u975e\u5982\u6b64\u3002expln \u5206\u6790\u663e\u793a\uff0c\u8be5\u67e5\u8be2\u6ca1\u6709\u8d70\u7d22\u5f15\uff0c\u800c\u662f\u8fdb\u884c\u4e86\u5168\u8868\u626b\u63cf\u3002\u8fd9\u662f\u56e0\u4e3a\uff1a<\/p>\n<p><strong>select * \u67e5\u8be2\u5bfc\u81f4\u7d22\u5f15\u65e0\u6548<\/strong><\/p>\n<p>\u6267\u884c &#8220;SELECT *&#8221; \u67e5\u8be2\u65f6\uff0cMySQL \u5c06\u8fd4\u56de\u8868\u4e2d\u7684\u6240\u6709\u5217\u3002\u8fd9\u5bfc\u81f4\u4e86\u5bf9\u7d22\u5f15\u7684\u56de\u8868\u64cd\u4f5c\uff0c\u56e0\u4e3a\u7d22\u5f15\u7ed3\u6784\u4e2d\u4e0d\u5305\u542b\u8be5\u67e5\u8be2\u6240\u9700\u7684\u6240\u6709\u6570\u636e\u3002\u56de\u8868\u64cd\u4f5c\u4f1a\u964d\u4f4e\u67e5\u8be2\u6027\u80fd\uff0c\u5e76\u963b\u6b62\u7ec4\u5408\u7d22\u5f15\u88ab\u6709\u6548\u5229\u7528\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u8981\u4f7f\u7ec4\u5408\u7d22\u5f15\u751f\u6548\uff0c\u9700\u8981\u4fee\u6539\u67e5\u8be2\u4ee5\u4ec5\u9009\u62e9\u5fc5\u8981\u7684\u5217\u3002\u4f8b\u5982\uff0c\u66f4\u6539\u4e3a &#8220;SELECT B, C FROM Table where B=1 and C = 2&#8221; \u53ef\u4ee5\u4f7f MySQL \u4f7f\u7528\u7ec4\u5408\u7d22\u5f15\u6765\u5feb\u901f\u83b7\u53d6\u6240\u9700\u6570\u636e\uff0c\u907f\u514d\u56de\u8868\u64cd\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u7ec4\u5408\u7d22\u5f15\u4e3a\u4f55\u5931\u6548\uff1f\u201cSELECT *\u201d \u67e5\u8be2\u4e3a\u4f55\u4f1a\u963b\u788d\u7d22\u5f15\u7684\u4f7f\u7528\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u7ec4\u5408\u7d22\u5f15\u672a\u751f\u6548\u7684\u5206\u6790 \u95ee\u9898\uff1a \u5bf9\u4e8e\u62e5\u6709\u4e3b\u952e A \u548c\u7ec4\u5408\u7d22\u5f15 B\u3001C \u7684\u8868\uff0c MySQL \u65e0\u6cd5\u5728\u67e5\u8be2\u8bed\u53e5 &#8220;SELECT * FROM Table where B=1 and C = 2&#8221; \u4e2d\u4f7f\u7528\u8be5\u7ec4\u5408\u7d22\u5f15\uff1f \u5206\u6790\uff1a \u867d\u7136 GPT \u58f0\u79f0\u8be5\u67e5\u8be2\u53ef\u4ee5\u4f7f\u7528\u7ec4\u5408\u7d22\u5f15\uff0c\u4f46\u5b9e\u9645\u60c5\u51b5\u5e76\u975e\u5982\u6b64\u3002expln \u5206\u6790\u663e\u793a\uff0c\u8be5\u67e5\u8be2\u6ca1\u6709\u8d70\u7d22\u5f15\uff0c\u800c\u662f\u8fdb\u884c\u4e86\u5168\u8868\u626b\u63cf\u3002\u8fd9\u662f\u56e0\u4e3a\uff1a select * \u67e5\u8be2\u5bfc\u81f4\u7d22\u5f15\u65e0\u6548 \u6267\u884c &#8220;SELECT *&#8221; \u67e5\u8be2\u65f6\uff0cMySQL \u5c06\u8fd4\u56de\u8868\u4e2d\u7684\u6240\u6709\u5217\u3002\u8fd9\u5bfc\u81f4\u4e86\u5bf9\u7d22\u5f15\u7684\u56de\u8868\u64cd\u4f5c\uff0c\u56e0\u4e3a\u7d22\u5f15\u7ed3\u6784\u4e2d\u4e0d\u5305\u542b\u8be5\u67e5\u8be2\u6240\u9700\u7684\u6240\u6709\u6570\u636e\u3002\u56de\u8868\u64cd\u4f5c\u4f1a\u964d\u4f4e\u67e5\u8be2\u6027\u80fd\uff0c\u5e76\u963b\u6b62\u7ec4\u5408\u7d22\u5f15\u88ab\u6709\u6548\u5229\u7528\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u8981\u4f7f\u7ec4\u5408\u7d22\u5f15\u751f\u6548\uff0c\u9700\u8981\u4fee\u6539\u67e5\u8be2\u4ee5\u4ec5\u9009\u62e9\u5fc5\u8981\u7684\u5217\u3002\u4f8b\u5982\uff0c\u66f4\u6539\u4e3a &#8220;SELECT B, C FROM Table where B=1 and C = 2&#8221; \u53ef\u4ee5\u4f7f MySQL \u4f7f\u7528\u7ec4\u5408\u7d22\u5f15\u6765\u5feb\u901f\u83b7\u53d6\u6240\u9700\u6570\u636e\uff0c\u907f\u514d\u56de\u8868\u64cd\u4f5c\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL \u7ec4\u5408\u7d22\u5f15\u4e3a\u4f55\u5931\u6548\uff1f\u201cSELECT *\u201d \u67e5\u8be2\u4e3a\u4f55\u4f1a\u963b\u788d\u7d22\u5f15\u7684\u4f7f\u7528\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-27696","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27696","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=27696"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27696\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}