{"id":219266,"date":"2023-12-24T00:58:18","date_gmt":"2023-12-23T16:58:18","guid":{"rendered":"https:\/\/www.idc.net\/help\/219266\/"},"modified":"2023-12-24T00:58:18","modified_gmt":"2023-12-23T16:58:18","slug":"mysql%e5%85%a5%e9%97%a8%ef%bc%9a%e4%bd%bf%e7%94%a8select-from-table%e4%bb%8e%e4%b8%80%e4%b8%aa%e8%a1%a8%e4%b8%ad%e9%80%89%e6%8b%a9%e6%89%80%e6%9c%89%e6%95%b0%e6%8d%ae%e3%80%82","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/219266\/","title":{"rendered":"MySQL\u5165\u95e8\uff1a\u4f7f\u7528SELECT * FROM [table]\u4ece\u4e00\u4e2a\u8868\u4e2d\u9009\u62e9\u6240\u6709\u6570\u636e\u3002"},"content":{"rendered":"<p><title id=\"mysql%e5%85%a5%e9%97%a8%ef%bc%9a%e4%bd%bf%e7%94%a8select-from-table%e4%bb%8e%e4%b8%80%e4%b8%aa%e8%a1%a8%e4%b8%ad%e9%80%89%e6%8b%a9%e6%89%80%e6%9c%89%e6%95%b0%e6%8d%ae-YGOldIIErL\">MySQL\u5165\u95e8\uff1a\u4f7f\u7528SELECT * FROM [table]\u4ece\u4e00\u4e2a\u8868\u4e2d\u9009\u62e9\u6240\u6709\u6570\u636e<\/title><\/p>\n<h1 id=\"mysql%e5%85%a5%e9%97%a8%ef%bc%9a%e4%bd%bf%e7%94%a8select-from-table%e4%bb%8e%e4%b8%80%e4%b8%aa%e8%a1%a8%e4%b8%ad%e9%80%89%e6%8b%a9%e6%89%80%e6%9c%89%e6%95%b0%e6%8d%ae-YGOldIIErL\">MySQL\u5165\u95e8\uff1a\u4f7f\u7528SELECT * FROM [table]\u4ece\u4e00\u4e2a\u8868\u4e2d\u9009\u62e9\u6240\u6709\u6570\u636e<\/h1>\n<p>MySQL\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u7528\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3002\u5728MySQL\u4e2d\uff0c\u4f7f\u7528SELECT\u8bed\u53e5\u53ef\u4ee5\u4ece\u4e00\u4e2a\u8868\u4e2d\u9009\u62e9\u6570\u636e\u3002\u5f53\u6211\u4eec\u60f3\u8981\u9009\u62e9\u4e00\u4e2a\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528SELECT * FROM [table]\u8bed\u53e5\u3002<\/p>\n<h2 id=\"select%e8%af%ad%e5%8f%a5-YGOldIIErL\">SELECT\u8bed\u53e5<\/h2>\n<p>SELECT\u8bed\u53e5\u662fMySQL\u4e2d\u6700\u5e38\u7528\u7684\u8bed\u53e5\u4e4b\u4e00\uff0c\u7528\u4e8e\u4ece\u4e00\u4e2a\u6216\u591a\u4e2a\u8868\u4e2d\u9009\u62e9\u6570\u636e\u3002\u5b83\u7684\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>SELECT column1, column2, ...\nFROM table_name;<\/code><\/pre>\n<p>\u5176\u4e2d\uff0ccolumn1, column2, ...\u662f\u8981\u9009\u62e9\u7684\u5217\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26*\u8868\u793a\u9009\u62e9\u6240\u6709\u5217\u3002table_name\u662f\u8981\u9009\u62e9\u6570\u636e\u7684\u8868\u540d\u3002<\/p>\n<h2 id=\"%e9%80%89%e6%8b%a9%e6%89%80%e6%9c%89%e6%95%b0%e6%8d%ae-YGOldIIErL\">\u9009\u62e9\u6240\u6709\u6570\u636e<\/h2>\n<p>\u8981\u9009\u62e9\u4e00\u4e2a\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528SELECT * FROM [table]\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u6709\u4e00\u4e2a\u540d\u4e3a\"users\"\u7684\u8868\uff0c\u5305\u542b\u4e86\u7528\u6237\u7684\u59d3\u540d\u3001\u5e74\u9f84\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\u9009\u62e9\u6240\u6709\u6570\u636e\uff1a<\/p>\n<pre><code>SELECT * FROM users;<\/code><\/pre>\n<p>\u8fd9\u5c06\u8fd4\u56de\"users\"\u8868\u4e2d\u7684\u6240\u6709\u884c\u548c\u5217\u3002<\/p>\n<h2 id=\"%e7%a4%ba%e4%be%8b-YGOldIIErL\">\u793a\u4f8b<\/h2>\n<p>\u8ba9\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u793a\u4f8b\u6765\u6f14\u793a\u5982\u4f55\u4f7f\u7528SELECT * FROM [table]\u9009\u62e9\u4e00\u4e2a\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\u3002<\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u540d\u4e3a\"employees\"\u7684\u8868\uff0c\u5305\u542b\u4e86\u5458\u5de5\u7684\u59d3\u540d\u3001\u804c\u4f4d\u548c\u85aa\u6c34\u3002\u4ee5\u4e0b\u662f\u8be5\u8868\u7684\u7ed3\u6784\uff1a<\/p>\n<pre><code>+----+----------+-------------+--------+\n| id | name     | position    | salary |\n+----+----------+-------------+--------+\n| 1  | John     | Manager     | 5000   |\n| 2  | Lisa     | Developer   | 4000   |\n| 3  | Michael  | Designer    | 3000   |\n+----+----------+-------------+--------+<\/code><\/pre>\n<p>\u8981\u9009\u62e9\"employees\"\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre><code>SELECT * FROM employees;<\/code><\/pre>\n<p>\u6267\u884c\u4ee5\u4e0a\u8bed\u53e5\u540e\uff0c\u5c06\u8fd4\u56de\u4ee5\u4e0b\u7ed3\u679c\uff1a<\/p>\n<pre><code>+----+----------+-------------+--------+\n| id | name     | position    | salary |\n+----+----------+-------------+--------+\n| 1  | John     | Manager     | 5000   |\n| 2  | Lisa     | Developer   | 4000   |\n| 3  | Michael  | Designer    | 3000   |\n+----+----------+-------------+--------+<\/code><\/pre>\n<h2 id=\"%e6%80%bb%e7%bb%93-YGOldIIErL\">\u603b\u7ed3<\/h2>\n<p>\u5728MySQL\u4e2d\uff0c\u4f7f\u7528SELECT * FROM [table]\u8bed\u53e5\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\u3002\u8fd9\u662f\u4e00\u79cd\u5e38\u7528\u7684\u67e5\u8be2\u8bed\u53e5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u83b7\u53d6\u8868\u4e2d\u7684\u5168\u90e8\u6570\u636e\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5bfb\u627e\u53ef\u9760\u7684\u4e91\u8ba1\u7b97\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u540e\u6d6a\u4e91\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u4ed6\u4eec\u63d0\u4f9b\u9999\u6e2f\u670d\u52a1\u5668\u3001\u7f8e\u56fd\u670d\u52a1\u5668\u548c\u4e91\u670d\u52a1\u5668\u7b49\u591a\u79cd\u4ea7\u54c1\uff0c\u6ee1\u8db3\u4e0d\u540c\u7528\u6237\u7684\u9700\u6c42\u3002\u60a8\u53ef\u4ee5\u8bbf\u95ee<a href=\"https:\/\/idc.net\">\u540e\u6d6a\u4e91\u5b98\u7f51<\/a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u5165\u95e8\uff1a\u4f7f\u7528SELECT * FROM [table]\u4ece\u4e00\u4e2a\u8868\u4e2d\u9009\u62e9\u6240\u6709\u6570\u636e MySQL\u5165\u95e8\uff1a\u4f7f\u7528SE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7038],"tags":[],"class_list":["post-219266","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/219266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=219266"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/219266\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=219266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=219266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=219266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}