{"id":201095,"date":"2025-05-06T08:29:13","date_gmt":"2025-05-06T00:29:13","guid":{"rendered":"https:\/\/server.hk\/cnblog\/201095\/"},"modified":"2025-05-06T08:29:13","modified_gmt":"2025-05-06T00:29:13","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:\/\/server.hk\/cnblog\/201095\/","title":{"rendered":"MySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>MySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300aMySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f\u300b\uff0c\u8986\u76d6\u4e86\u6570\u636e\u5e93\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241201\/1733015030674bb5f61871d.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>mysql \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>\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>\u4ece users \u8868\u4e2d\u68c0\u7d22\u6240\u6709\u8bb0\u5f55\uff1a<\/p>\n<pre>select * from users;<\/pre>\n<p>\u66f4\u65b0 users \u8868\u4e2d\u7684\u8bb0\u5f55\uff0c\u5c06 email \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>\u5220\u9664 users \u8868\u4e2d id \u4e3a 1 \u7684\u8bb0\u5f55\uff1a<\/p>\n<pre>DELETE FROM users WHERE id = 1;<\/pre>\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>\u4eca\u5929\u5173\u4e8e\u300aMySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709\u54ea\u4e9b\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u6570\u636e\u5e93\u5e38\u7528\u57fa\u7840\u547d\u4ee4\u6709&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-201095","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=201095"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201095\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=201095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=201095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=201095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}