{"id":6594,"date":"2024-11-14T14:04:08","date_gmt":"2024-11-14T06:04:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6594\/"},"modified":"2024-11-14T14:04:08","modified_gmt":"2024-11-14T06:04:08","slug":"mysql%e8%84%9a%e6%9c%ac%e6%80%8e%e4%b9%88%e5%86%99","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6594\/","title":{"rendered":"mysql\u811a\u672c\u600e\u4e48\u5199"},"content":{"rendered":"<blockquote><p>\n  \u7f16\u5199 mysql \u811a\u672c\u6307\u5357\uff1a\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982 notepad++\uff09\u521b\u5efa .sql \u6587\u4ef6\u3002\u7f16\u5199 sql \u67e5\u8be2\uff0c\u4ee5\u5206\u53f7 (;) \u7ed3\u5c3e\u3002\u4f7f\u7528\u6ce8\u91ca\uff08&#8211;\uff09\u63d0\u9ad8\u811a\u672c\u53ef\u8bfb\u6027\u3002\u4fdd\u5b58\u811a\u672c\u6587\u4ef6\u3002\u4f7f\u7528 mysql \u547d\u4ee4\u884c\u6216 mysql workbench \u6267\u884c\u811a\u672c\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/06\/2024080618432322402.jpg\" class=\"aligncenter\" title=\"mysql\u811a\u672c\u600e\u4e48\u5199\u63d2\u56fe\" alt=\"mysql\u811a\u672c\u600e\u4e48\u5199\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u811a\u672c\u7684\u7f16\u5199\u6307\u5357<\/strong><\/p>\n<p><strong>\u7b80\u4ecb<\/strong><\/p>\n<p>MySQL \u811a\u672c\u662f\u7528\u4e8e\u81ea\u52a8\u6267\u884c MySQL \u6570\u636e\u5e93\u4efb\u52a1\u7684\u6587\u672c\u6587\u4ef6\u3002\u5b83\u4eec\u53ef\u4ee5\u7b80\u5316\u6570\u636e\u5e93\u7ba1\u7406\uff0c\u63d0\u9ad8\u6548\u7387\u548c\u51c6\u786e\u6027\u3002<\/p>\n<p><strong>\u7f16\u5199 MySQL \u811a\u672c\u7684\u6b65\u9aa4<\/strong><\/p>\n<ol>\n<li> <strong>\u9009\u62e9\u6587\u672c\u7f16\u8f91\u5668\uff1a<\/strong>\u9009\u62e9\u4e00\u4e2a\u652f\u6301\u8bed\u6cd5\u9ad8\u4eae\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4f8b\u5982 Notepad++ \u6216 Sublime Text\u3002<\/li>\n<li> <strong>\u521b\u5efa\u65b0\u6587\u4ef6\uff1a<\/strong>\u521b\u5efa\u65b0\u6587\u672c\u6587\u4ef6\u5e76\u5c06\u5176\u53e6\u5b58\u4e3a\u5177\u6709 .sql \u6269\u5c55\u540d\u7684\u6587\u4ef6\u3002<\/li>\n<li> <strong>\u7f16\u5199\u67e5\u8be2\uff1a<\/strong>\u8f93\u5165 SQL \u67e5\u8be2\uff0c\u5305\u62ec CREATE\u3001SELECT\u3001UPDATE \u6216 DELETE \u8bed\u53e5\u3002<\/li>\n<li> <strong>\u5206\u53f7\u5206\u9694\uff1a<\/strong>\u6bcf\u4e2a MySQL \u8bed\u53e5\u5fc5\u987b\u4ee5\u5206\u53f7 (;) \u7ed3\u5c3e\u3002<\/li>\n<li> <strong>\u6ce8\u91ca\uff1a<\/strong>\u4f7f\u7528 &#8212; \u5f00\u59cb\u6ce8\u91ca\u884c\uff0c\u4ee5\u63d0\u9ad8\u811a\u672c\u53ef\u8bfb\u6027\u3002<\/li>\n<li> <strong>\u4fdd\u5b58\u811a\u672c\uff1a<\/strong>\u4fdd\u5b58\u811a\u672c\u6587\u4ef6\u3002<\/li>\n<\/ol>\n<p><strong>\u811a\u672c\u793a\u4f8b<\/strong><\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a &#8220;customers&#8221; \u7684\u8868\uff1a<\/p>\n<pre>-- \u521b\u5efa \"customers\" \u8868\nCREATE TABLE customers (\n  customer_id   INT NOT NULL AUTO_INCREMENT,\n  first_name    VARCHAR(255) NOT NULL,\n  last_name     VARCHAR(255) NOT NULL,\n  email         VARCHAR(255) UNIQUE NOT NULL,\n  phone_number  VARCHAR(20) UNIQUE NOT NULL,\n  PRIMARY KEY (customer_id)\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63d2\u5165\u6570\u636e\uff1a<\/p>\n<pre>-- \u5411 \"customers\" \u8868\u63d2\u5165\u6570\u636e\nINSERT INTO customers (first_name, last_name, email, phone_number) VALUES\n('John', 'Doe', 'john.doe@example.com', '555-123-4567'),\n('Jane', 'Smith', 'jane.smith@example.com', '555-234-5678');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6267\u884c\u811a\u672c<\/strong><\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u6267\u884c MySQL \u811a\u672c\uff1a<\/p>\n<ul>\n<li> <strong>MySQL \u547d\u4ee4\u884c\uff1a<\/strong>\u5728 MySQL \u547d\u4ee4\u884c\u63d0\u793a\u7b26\u4e0b\u952e\u5165 source \u3002<\/li>\n<li> <strong>MySQL Workbench\uff1a<\/strong>\u53f3\u952e\u5355\u51fb\u6570\u636e\u5e93\u8fde\u63a5\u5e76\u9009\u62e9 &#8220;Execute Script&#8221;\u3002<\/li>\n<\/ul>\n<p><strong>\u6700\u4f73\u5b9e\u8df5<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528\u6e05\u6670\u4e14\u6709\u610f\u4e49\u7684\u8868\u548c\u5217\u540d\u79f0\u3002<\/li>\n<li>\u6ce8\u91ca\u60a8\u7684\u811a\u672c\u4ee5\u89e3\u91ca\u5176\u76ee\u7684\u3002<\/li>\n<li>\u6d4b\u8bd5\u811a\u672c\u4ee5\u786e\u4fdd\u5176\u6b63\u786e\u8fd0\u884c\u3002<\/li>\n<li>\u5907\u4efd\u6570\u636e\u5e93\u5728\u6267\u884c\u811a\u672c\u4e4b\u524d\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u811a\u672c\u600e\u4e48\u5199\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>\u7f16\u5199 mysql \u811a\u672c\u6307\u5357\uff1a\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982 notepad++\uff09\u521b\u5efa .sql \u6587\u4ef6\u3002\u7f16\u5199 sql \u67e5\u8be2\uff0c\u4ee5\u5206\u53f7 (;) \u7ed3\u5c3e\u3002\u4f7f\u7528\u6ce8\u91ca\uff08&#8211;\uff09\u63d0\u9ad8\u811a\u672c\u53ef\u8bfb\u6027\u3002\u4fdd\u5b58\u811a\u672c\u6587\u4ef6\u3002\u4f7f\u7528 mysql \u547d\u4ee4\u884c\u6216 mysql workbench \u6267\u884c\u811a\u672c\u3002 MySQL \u811a\u672c\u7684\u7f16\u5199\u6307\u5357 \u7b80\u4ecb MySQL \u811a\u672c\u662f\u7528\u4e8e\u81ea\u52a8\u6267\u884c MySQL \u6570\u636e\u5e93\u4efb\u52a1\u7684\u6587\u672c\u6587\u4ef6\u3002\u5b83\u4eec\u53ef\u4ee5\u7b80\u5316\u6570\u636e\u5e93\u7ba1\u7406\uff0c\u63d0\u9ad8\u6548\u7387\u548c\u51c6\u786e\u6027\u3002 \u7f16\u5199 MySQL \u811a\u672c\u7684\u6b65\u9aa4 \u9009\u62e9\u6587\u672c\u7f16\u8f91\u5668\uff1a\u9009\u62e9\u4e00\u4e2a\u652f\u6301\u8bed\u6cd5\u9ad8\u4eae\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4f8b\u5982 Notepad++ \u6216 Sublime Text\u3002 \u521b\u5efa\u65b0\u6587\u4ef6\uff1a\u521b\u5efa\u65b0\u6587\u672c\u6587\u4ef6\u5e76\u5c06\u5176\u53e6\u5b58\u4e3a\u5177\u6709 .sql \u6269\u5c55\u540d\u7684\u6587\u4ef6\u3002 \u7f16\u5199\u67e5\u8be2\uff1a\u8f93\u5165 SQL \u67e5\u8be2\uff0c\u5305\u62ec CREATE\u3001SELECT\u3001UPDATE \u6216 DELETE \u8bed\u53e5\u3002 \u5206\u53f7\u5206\u9694\uff1a\u6bcf\u4e2a MySQL \u8bed\u53e5\u5fc5\u987b\u4ee5\u5206\u53f7 (;) \u7ed3\u5c3e\u3002 \u6ce8\u91ca\uff1a\u4f7f\u7528 &#8212; \u5f00\u59cb\u6ce8\u91ca\u884c\uff0c\u4ee5\u63d0\u9ad8\u811a\u672c\u53ef\u8bfb\u6027\u3002 \u4fdd\u5b58\u811a\u672c\uff1a\u4fdd\u5b58\u811a\u672c\u6587\u4ef6\u3002 \u811a\u672c\u793a\u4f8b \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a &#8220;customers&#8221; \u7684\u8868\uff1a &#8212; \u521b\u5efa [&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-6594","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6594","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=6594"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6594\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}