{"id":5624,"date":"2024-11-14T09:05:33","date_gmt":"2024-11-14T01:05:33","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5624\/"},"modified":"2024-11-14T09:05:33","modified_gmt":"2024-11-14T01:05:33","slug":"sql%e6%80%8e%e4%b9%88%e5%9c%a8%e5%88%9b%e5%bb%ba%e8%a1%a8%e7%9a%84%e6%97%b6%e5%80%99%e7%bb%99%e5%ad%97%e6%ae%b5%e6%b7%bb%e5%8a%a0%e5%a4%87%e6%b3%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5624\/","title":{"rendered":"sql\u600e\u4e48\u5728\u521b\u5efa\u8868\u7684\u65f6\u5019\u7ed9\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8"},"content":{"rendered":"<blockquote><p>\n  \u5728 sql \u4e2d\uff0c\u4e3a\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\u53ef\u5728\u521b\u5efa\u8868\u65f6\u4f7f\u7528 comment \u5b50\u53e5\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a\u521b\u5efa\u8868\u65f6\u4f7f\u7528 comment \u5b50\u53e5\u6dfb\u52a0\u5b57\u6bb5\u5907\u6ce8\u3002\u4f7f\u7528 show create table \u8bed\u53e5\u67e5\u770b\u6dfb\u52a0\u7684\u5907\u6ce8\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053019151963586.jpg\" class=\"aligncenter\" title=\"sql\u600e\u4e48\u5728\u521b\u5efa\u8868\u7684\u65f6\u5019\u7ed9\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\u63d2\u56fe\" alt=\"sql\u600e\u4e48\u5728\u521b\u5efa\u8868\u7684\u65f6\u5019\u7ed9\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\u63d2\u56fe\" \/><\/p>\n<p><strong>SQL \u4e2d\u4e3a\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8<\/strong><\/p>\n<p>\u5728\u521b\u5efa\u8868\u65f6\u4e3a\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\u53ef\u4ee5\u5e2e\u52a9\u7406\u89e3\u8868\u7684\u7ed3\u6784\u548c\u6bcf\u4e2a\u5b57\u6bb5\u7684\u7528\u9014\u3002\u5728 SQL \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 COMMENT \u5b50\u53e5\u5728\u521b\u5efa\u8868\u8bed\u53e5\u4e2d\u6dfb\u52a0\u5b57\u6bb5\u5907\u6ce8\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>CREATE TABLE table_name (\n    field_name data_type COMMENT 'remark'\n);<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>CREATE TABLE customers (\n    id INT NOT NULL AUTO_INCREMENT,\n    name VARCHAR(255) NOT NULL COMMENT 'Customer's full name',\n    email VARCHAR(255) UNIQUE COMMENT 'Customer's email address'\n);<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u6548\u679c\uff1a<\/strong><\/p>\n<p>\u6267\u884c\u4e0a\u8ff0\u8bed\u53e5\u540e\uff0ccustomers \u8868\u5c06\u521b\u5efa\uff0c\u5176\u5b57\u6bb5\u7684\u5907\u6ce8\u5c06\u5b58\u50a8\u5728\u8868\u7684\u5143\u6570\u636e\u4e2d\u3002\u53ef\u4ee5\u4f7f\u7528 SHOW CREATE TABLE \u8bed\u53e5\u67e5\u770b\u5907\u6ce8\uff1a<\/p>\n<pre>SHOW CREATE TABLE customers;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u8f93\u51fa\uff1a<\/strong><\/p>\n<pre>CREATE TABLE `customers` (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) NOT NULL COMMENT 'Customer''s full name',\n  `email` varchar(255) NOT NULL UNIQUE COMMENT 'Customer''s email address',\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u5907\u6ce8\u4ec5\u7528\u4e8e\u6587\u6863\u76ee\u7684\uff0c\u4e0d\u5f71\u54cd\u8868\u7684\u5b9e\u9645\u529f\u80fd\u6216\u6570\u636e\u3002<\/li>\n<li>\u5907\u6ce8\u53ef\u4ee5\u5305\u542b\u4efb\u4f55\u6587\u672c\uff0c\u5305\u62ec\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\u3002<\/li>\n<li>\u5907\u6ce8\u957f\u5ea6\u7684\u9650\u5236\u56e0\u6570\u636e\u5e93\u800c\u5f02\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fsql\u600e\u4e48\u5728\u521b\u5efa\u8868\u7684\u65f6\u5019\u7ed9\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\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>\u5728 sql \u4e2d\uff0c\u4e3a\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\u53ef\u5728\u521b\u5efa\u8868\u65f6\u4f7f\u7528 comment \u5b50\u53e5\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a\u521b\u5efa\u8868\u65f6\u4f7f\u7528 comment \u5b50\u53e5\u6dfb\u52a0\u5b57\u6bb5\u5907\u6ce8\u3002\u4f7f\u7528 show create table \u8bed\u53e5\u67e5\u770b\u6dfb\u52a0\u7684\u5907\u6ce8\u3002 SQL \u4e2d\u4e3a\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8 \u5728\u521b\u5efa\u8868\u65f6\u4e3a\u5b57\u6bb5\u6dfb\u52a0\u5907\u6ce8\u53ef\u4ee5\u5e2e\u52a9\u7406\u89e3\u8868\u7684\u7ed3\u6784\u548c\u6bcf\u4e2a\u5b57\u6bb5\u7684\u7528\u9014\u3002\u5728 SQL \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 COMMENT \u5b50\u53e5\u5728\u521b\u5efa\u8868\u8bed\u53e5\u4e2d\u6dfb\u52a0\u5b57\u6bb5\u5907\u6ce8\u3002 \u8bed\u6cd5\uff1a CREATE TABLE table_name ( field_name data_type COMMENT &#8216;remark&#8217; ); \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\uff1a CREATE TABLE customers ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL COMMENT &#8216;Customer&#8217;s full name&#8217;, email VARCHAR(255) UNIQUE COMMENT &#8216;Customer&#8217;s email address&#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-5624","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5624","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=5624"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5624\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}