{"id":7473,"date":"2024-11-14T16:20:44","date_gmt":"2024-11-14T08:20:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7473\/"},"modified":"2024-11-14T16:20:44","modified_gmt":"2024-11-14T08:20:44","slug":"mysql-%e6%95%b0%e6%8d%ae%e5%ba%93%e5%b8%b8%e7%94%a8%e5%9f%ba%e7%a1%80%e5%91%bd%e4%bb%a4%e6%9c%89%e5%93%aa%e4%ba%9b%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7473\/","title":{"rendered":"MySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173088489354272.jpg\" class=\"aligncenter\" title=\"MySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f\u63d2\u56fe\" alt=\"MySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u5e38\u7528\u57fa\u7840\u547d\u4ee4<\/strong><\/p>\n<p>\u5728 mysql \u6570\u636e\u5e93\u4e2d\uff0c\u57fa\u7840\u547d\u4ee4\u662f\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u57fa\u77f3\u3002\u901a\u8fc7\u4f7f\u7528\u8fd9\u4e9b\u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u3001\u4fee\u6539\u548c\u7ba1\u7406\u6570\u636e\u5e93\u53ca\u8868\u3002<\/p>\n<p><strong>\u5efa\u8868\u8bed\u53e5<\/strong><\/p>\n<ul>\n<li>create table\uff1a\u521b\u5efa\u4e00\u4e2a\u65b0\u8868\u3002<\/li>\n<li>alter table\uff1a\u4fee\u6539\u73b0\u6709\u8868\u7684\u7ed3\u6784\u3002<\/li>\n<li>drop table\uff1a\u5220\u9664\u4e00\u4e2a\u8868\u3002<\/li>\n<\/ul>\n<p><strong>\u529f\u80fd\u578b\u8bed\u53e5<\/strong><\/p>\n<ul>\n<li>select\uff1a\u4ece\u8868\u4e2d\u68c0\u7d22\u6570\u636e\u3002<\/li>\n<li>insert\uff1a\u5411\u8868\u4e2d\u63d2\u5165\u65b0\u6570\u636e\u3002<\/li>\n<li>update\uff1a\u66f4\u65b0\u8868\u4e2d\u7684\u73b0\u6709\u6570\u636e\u3002<\/li>\n<li>delete\uff1a\u4ece\u8868\u4e2d\u5220\u9664\u6570\u636e\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a users \u7684\u8868\uff1a<\/p>\n<pre>create table users (\n  id int not null auto_increment,\n  name varchar(255) not null,\n  email varchar(255) unique not null,\n  primary key (id)\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 users \u8868\u4e2d\u63d2\u5165\u4e00\u6761\u8bb0\u5f55\uff1a<\/p>\n<pre>insert into users (name, email) values ('john doe', 'john.doe@example.com');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ece users \u8868\u4e2d\u68c0\u7d22\u6240\u6709\u8bb0\u5f55\uff1a<\/p>\n<pre>select * from users;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u66f4\u65b0 users \u8868\u4e2d\u7684\u8bb0\u5f55\uff0c\u5c06 eml \u4fee\u6539\u4e3a jane.doe@example.com\uff1a<\/p>\n<pre>update users set email = 'jane.doe@example.com' where id = 1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5220\u9664 users \u8868\u4e2d id \u4e3a 1 \u7684\u8bb0\u5f55\uff1a<\/p>\n<pre>DELETE FROM users WHERE id = 1;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4e86\u89e3\u8fd9\u4e9b\u57fa\u7840\u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u5f00\u59cb\u63a2\u7d22 mysql \u6570\u636e\u5e93\u7684\u5f3a\u5927\u529f\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e38\u7528\u57fa\u7840\u547d\u4ee4 \u5728 mysql \u6570\u636e\u5e93\u4e2d\uff0c\u57fa\u7840\u547d\u4ee4\u662f\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u57fa\u77f3\u3002\u901a\u8fc7\u4f7f\u7528\u8fd9\u4e9b\u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u3001\u4fee\u6539\u548c\u7ba1\u7406\u6570\u636e\u5e93\u53ca\u8868\u3002 \u5efa\u8868\u8bed\u53e5 create table\uff1a\u521b\u5efa\u4e00\u4e2a\u65b0\u8868\u3002 alter table\uff1a\u4fee\u6539\u73b0\u6709\u8868\u7684\u7ed3\u6784\u3002 drop table\uff1a\u5220\u9664\u4e00\u4e2a\u8868\u3002 \u529f\u80fd\u578b\u8bed\u53e5 select\uff1a\u4ece\u8868\u4e2d\u68c0\u7d22\u6570\u636e\u3002 insert\uff1a\u5411\u8868\u4e2d\u63d2\u5165\u65b0\u6570\u636e\u3002 update\uff1a\u66f4\u65b0\u8868\u4e2d\u7684\u73b0\u6709\u6570\u636e\u3002 delete\uff1a\u4ece\u8868\u4e2d\u5220\u9664\u6570\u636e\u3002 \u793a\u4f8b \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a users \u7684\u8868\uff1a create table users ( id int not null auto_increment, name varchar(255) not null, email varchar(255) unique not null, primary key (id) ); \u767b\u5f55\u540e\u590d\u5236 \u5728 users \u8868\u4e2d\u63d2\u5165\u4e00\u6761\u8bb0\u5f55\uff1a insert into users (name, email) values (&#8216;john doe&#8217;, &#8216;john.doe@example.com&#8217;); [&hellip;]<\/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-7473","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7473","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=7473"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7473\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}