{"id":25798,"date":"2024-11-24T13:58:15","date_gmt":"2024-11-24T05:58:15","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25798\/"},"modified":"2024-11-24T13:58:15","modified_gmt":"2024-11-24T05:58:15","slug":"mysql-%e6%95%b0%e6%8d%ae%e8%a1%a8%e6%8f%92%e5%85%a5%e6%96%b0%e8%a1%8c%e6%97%b6%ef%bc%8c%e4%b8%bb%e9%94%ae%e4%bc%9a%e8%87%aa%e5%8a%a8%e6%8e%92%e5%ba%8f%e5%90%97%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25798\/","title":{"rendered":"MySQL \u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u4e3b\u952e\u4f1a\u81ea\u52a8\u6392\u5e8f\u5417\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173070612471494.jpg\" class=\"aligncenter\" title=\"MySQL \u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u4e3b\u952e\u4f1a\u81ea\u52a8\u6392\u5e8f\u5417\uff1f\u63d2\u56fe\" alt=\"MySQL \u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u4e3b\u952e\u4f1a\u81ea\u52a8\u6392\u5e8f\u5417\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\u4e3b\u952e\u6392\u5e8f\u673a\u5236<\/strong><\/p>\n<p>\u5728 mysql \u6570\u636e\u8868\u4e2d\uff0c\u6b63\u5982\u95ee\u9898\u6240\u793a\uff0c\u5f53\u8868\u4e2d\u6709\u4e3b\u952e\u5217\uff08\u4f8b\u5982 id\uff09\u65f6\uff0c\u65b0\u589e\u884c\u8bb0\u5f55\u65f6\u4f1a\u6267\u884c\u4ec0\u4e48\u6837\u7684\u4e3b\u952e\u6392\u5e8f\u884c\u4e3a\u5462\uff1f<\/p>\n<p><strong>\u662f\u5426\u6309\u4e3b\u952e\u81ea\u52a8\u6392\u5e8f\u63d2\u5165\uff1f<\/strong><\/p>\n<p>\u95ee\u9898\u7684\u7b54\u6848\u662f\uff1a\u4e0d\u4f1a\u3002<\/p>\n<p><strong>\u63d2\u5165\u673a\u5236<\/strong><\/p>\n<p>mysql \u6570\u636e\u8868\u4e2d\u7684\u884c\u8bb0\u5f55\u5b9e\u9645\u4e0a\u4ee5\u65e0\u5e8f\u7684\u65b9\u5f0f\u5b58\u50a8\u3002\u56e0\u6b64\uff0c\u5f53\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u5b83\u4e0d\u4f1a\u81ea\u52a8\u6309\u7167\u4e3b\u952e\u503c\u8fdb\u884c\u6392\u5e8f\u63d2\u5165\u3002<\/p>\n<p>\u6b63\u5982\u7b54\u6848\u4e2d\u63d0\u5230\u7684\uff0c\u5982\u679c\u60a8\u60f3\u8981\u65b0\u8bb0\u5f55\u63d2\u5165\u5230\u6307\u5b9a\u7684\u4f4d\u7f6e\uff08\u5728\u672c\u4f8b\u4e2d\u662f 1002 \u4e4b\u540e\uff09\uff0c\u9700\u8981\u660e\u786e\u4f7f\u7528 order by \u5b50\u53e5\u5bf9\u8868\u8fdb\u884c\u6392\u5e8f\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>INSERT INTO user (id, name, email)\nVALUES (1003, 'ThinkPHP', 'ThinkPHP@gmail.com')\nORDER BY id DESC\nLIMIT 1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4f7f\u7528 order by \u5b50\u53e5\u548c limit \u5b50\u53e5\uff0c\u53ef\u4ee5\u63a7\u5236\u65b0\u8bb0\u5f55\u7684\u63d2\u5165\u987a\u5e8f\uff0c\u786e\u4fdd\u5b83\u88ab\u63d2\u5165\u5230\u8868\u4e2d\u7684\u6b63\u786e\u4f4d\u7f6e\u3002<\/p>\n<p><strong>\u65e0\u5e8f\u5b58\u50a8<\/strong><\/p>\n<p>\u91cd\u8981\u7684\u662f\u8981\u8bb0\u4f4f\uff0c\u5728\u5927\u591a\u6570\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff0c\u8868\u4e2d\u7684\u884c\u90fd\u4ee5\u65e0\u5e8f\u7684\u65b9\u5f0f\u5b58\u50a8\u3002\u5982\u679c\u6ca1\u6709\u660e\u786e\u7684\u6392\u5e8f\u4f9d\u636e\uff0c\u5219\u4e0d\u80fd\u5047\u8bbe\u884c\u8bb0\u5f55\u4f1a\u6309\u7167\u7279\u5b9a\u7684\u987a\u5e8f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u4e3b\u952e\u4f1a\u81ea\u52a8\u6392\u5e8f\u5417\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>\u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\u4e3b\u952e\u6392\u5e8f\u673a\u5236 \u5728 mysql \u6570\u636e\u8868\u4e2d\uff0c\u6b63\u5982\u95ee\u9898\u6240\u793a\uff0c\u5f53\u8868\u4e2d\u6709\u4e3b\u952e\u5217\uff08\u4f8b\u5982 id\uff09\u65f6\uff0c\u65b0\u589e\u884c\u8bb0\u5f55\u65f6\u4f1a\u6267\u884c\u4ec0\u4e48\u6837\u7684\u4e3b\u952e\u6392\u5e8f\u884c\u4e3a\u5462\uff1f \u662f\u5426\u6309\u4e3b\u952e\u81ea\u52a8\u6392\u5e8f\u63d2\u5165\uff1f \u95ee\u9898\u7684\u7b54\u6848\u662f\uff1a\u4e0d\u4f1a\u3002 \u63d2\u5165\u673a\u5236 mysql \u6570\u636e\u8868\u4e2d\u7684\u884c\u8bb0\u5f55\u5b9e\u9645\u4e0a\u4ee5\u65e0\u5e8f\u7684\u65b9\u5f0f\u5b58\u50a8\u3002\u56e0\u6b64\uff0c\u5f53\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u5b83\u4e0d\u4f1a\u81ea\u52a8\u6309\u7167\u4e3b\u952e\u503c\u8fdb\u884c\u6392\u5e8f\u63d2\u5165\u3002 \u6b63\u5982\u7b54\u6848\u4e2d\u63d0\u5230\u7684\uff0c\u5982\u679c\u60a8\u60f3\u8981\u65b0\u8bb0\u5f55\u63d2\u5165\u5230\u6307\u5b9a\u7684\u4f4d\u7f6e\uff08\u5728\u672c\u4f8b\u4e2d\u662f 1002 \u4e4b\u540e\uff09\uff0c\u9700\u8981\u660e\u786e\u4f7f\u7528 order by \u5b50\u53e5\u5bf9\u8868\u8fdb\u884c\u6392\u5e8f\uff0c\u5982\u4e0b\u6240\u793a\uff1a INSERT INTO user (id, name, email) VALUES (1003, &#8216;ThinkPHP&#8217;, &#8216;ThinkPHP@gmail.com&#8217;) ORDER BY id DESC LIMIT 1; \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u4f7f\u7528 order by \u5b50\u53e5\u548c limit \u5b50\u53e5\uff0c\u53ef\u4ee5\u63a7\u5236\u65b0\u8bb0\u5f55\u7684\u63d2\u5165\u987a\u5e8f\uff0c\u786e\u4fdd\u5b83\u88ab\u63d2\u5165\u5230\u8868\u4e2d\u7684\u6b63\u786e\u4f4d\u7f6e\u3002 \u65e0\u5e8f\u5b58\u50a8 \u91cd\u8981\u7684\u662f\u8981\u8bb0\u4f4f\uff0c\u5728\u5927\u591a\u6570\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff0c\u8868\u4e2d\u7684\u884c\u90fd\u4ee5\u65e0\u5e8f\u7684\u65b9\u5f0f\u5b58\u50a8\u3002\u5982\u679c\u6ca1\u6709\u660e\u786e\u7684\u6392\u5e8f\u4f9d\u636e\uff0c\u5219\u4e0d\u80fd\u5047\u8bbe\u884c\u8bb0\u5f55\u4f1a\u6309\u7167\u7279\u5b9a\u7684\u987a\u5e8f\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL \u6570\u636e\u8868\u63d2\u5165\u65b0\u884c\u65f6\uff0c\u4e3b\u952e\u4f1a\u81ea\u52a8\u6392\u5e8f\u5417\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-25798","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25798","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=25798"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25798\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}