{"id":66,"date":"2019-05-30T12:01:19","date_gmt":"2019-05-30T04:01:19","guid":{"rendered":"http:\/\/qssjx.com\/?p=66"},"modified":"2019-05-30T12:01:19","modified_gmt":"2019-05-30T04:01:19","slug":"mysql%e4%b8%ad%e7%bb%99%e8%a1%a8%e6%b7%bb%e5%8a%a0%e4%b8%80%e4%b8%aa%e5%ad%97%e6%ae%b5%ef%bc%88%e5%ad%97%e6%ae%b5%e5%90%8d%e3%80%81%e6%98%af%e5%90%a6%e4%b8%ba%e7%a9%ba%e3%80%81%e9%bb%98%e8%ae%a4","status":"publish","type":"post","link":"http:\/\/qssjx.com\/?p=66","title":{"rendered":"MySQL\u4e2d\u7ed9\u8868\u6dfb\u52a0\u4e00\u4e2a\u5b57\u6bb5\uff08\u5b57\u6bb5\u540d\u3001\u662f\u5426\u4e3a\u7a7a\u3001\u9ed8\u8ba4\u503c\uff09"},"content":{"rendered":"\n\t\t\t\t\n<p>\u672c\u6587\u4ecb\u7ecdMySQL\u6570\u636e\u5e93\u4f7f\u7528SQL\u8bed\u53e5\u6765\u5728\u73b0\u6709\u7684\u8868\u4e2d\uff0c\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5b57\u6bb5\uff0c\u5305\u62ec\u8bbe\u7f6e\u5b57\u6bb5\u7684\u662f\u5426\u4e3a\u7a7a\u3001\u9ed8\u8ba4\u503c\u7b49\u3002<\/p>\n\n\n\n<p>\u5148\u770b\u4e00\u4e0b\u6700\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5728test\u4e2d\uff0c\u6dfb\u52a0\u4e00\u4e2a\u5b57\u6bb5\uff0c\u5b57\u6bb5\u540d\u4e3abirth\uff0c\u7c7b\u578b\u4e3adate\u7c7b\u578b\u3002<\/p>\n\n\n\n<p>mysql&gt; alter table test add column birth date;<br>Query OK, 0 rows affected (0.36 sec)<br>Records: 0&nbsp; Duplicates: 0&nbsp; Warnings: 0<\/p>\n\n\n\n<p>\u67e5\u8be2\u4e00\u4e0b\u6570\u636e\uff0c\u770b\u770b\u7ed3\u679c\uff1a<\/p>\n\n\n\n<p>mysql&gt; select * from test;<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<br>| t_id | t_name | t_password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | t_birth&nbsp;&nbsp;&nbsp; | birth |<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<br>|&nbsp;&nbsp;&nbsp; 1 | name1&nbsp; | 12345678901234567890123456789012 | NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp; |<br>|&nbsp;&nbsp;&nbsp; 2 | name2&nbsp; | 12345678901234567890123456789012 | 2013-01-01 | NULL&nbsp; |<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<br>2 rows in set (0.00 sec)<\/p>\n\n\n\n<p>\u4ece\u4e0a\u9762\u7ed3\u679c\u53ef\u4ee5\u770b\u51fa\uff0c\u63d2\u5165\u7684birth\u5b57\u6bb5\uff0c\u9ed8\u8ba4\u503c\u4e3a\u7a7a\u3002\u6211\u4eec\u518d\u6765\u8bd5\u4e00\u4e0b\uff0c\u6dfb\u52a0\u4e00\u4e2abirth1\u5b57\u6bb5\uff0c\u8bbe\u7f6e\u5b83\u4e0d\u5141\u8bb8\u4e3a\u7a7a\u3002<\/p>\n\n\n\n<p>mysql&gt; alter table test add column birth1 date not null;<br>Query OK, 0 rows affected (0.16 sec)<br>Records: 0&nbsp; Duplicates: 0&nbsp; Warnings: 0<\/p>\n\n\n\n<p>\u5c45\u7136\u6267\u884c\u6210\u529f\u4e86\uff01\uff1f\u610f\u5916\u4e86\uff01\u6211\u539f\u6765\u4ee5\u4e3a\uff0c\u8fd9\u4e2a\u8bed\u53e5\u4e0d\u4f1a\u6210\u529f\u7684\uff0c\u56e0\u4e3a\u6211\u6ca1\u6709\u7ed9\u4ed6\u6307\u5b9a\u4e00\u4e2a\u9ed8\u8ba4\u503c\u3002\u6211\u4eec\u6765\u770b\u770b\u6570\u636e\uff1a<\/p>\n\n\n\n<p>mysql&gt; select * from test;<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+<br>| t_id | t_name | t_password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | t_birth&nbsp;&nbsp;&nbsp; | birth | birth1&nbsp;&nbsp;&nbsp;&nbsp; |<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+<br>|&nbsp;&nbsp;&nbsp; 1 | name1&nbsp; | 12345678901234567890123456789012 | NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp; | 0000-00-00 |<br>|&nbsp;&nbsp;&nbsp; 2 | name2&nbsp; | 12345678901234567890123456789012 | 2013-01-01 | NULL&nbsp; | 0000-00-00 |<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+<br>2 rows in set (0.00 sec)<\/p>\n\n\n\n<p>\u54e6\uff0c\u660e\u767d\u4e86\uff0c\u7cfb\u7edf\u81ea\u52a8\u5c06date\u7c7b\u578b\u7684\u503c\uff0c\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u9ed8\u8ba4\u503c\uff1a0000-00-00\u3002\u4e0b\u9762\u6211\u6765\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u9ed8\u8ba4\u503c\u770b\u770b\uff1a<\/p>\n\n\n\n<p>mysql&gt; alter table test add column birth2 date default &#8216;2013-1-1&#8217;;<br>Query OK, 0 rows affected (0.28 sec)<br>Records: 0&nbsp; Duplicates: 0&nbsp; Warnings: 0<\/p>\n\n\n\n<p>mysql&gt; select * from test;<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+<br>| t_id | t_name | t_password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | t_birth&nbsp;&nbsp;&nbsp; | birth | birth1&nbsp;&nbsp;&nbsp;&nbsp; | birth2&nbsp;&nbsp;&nbsp;&nbsp; |<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+<br>|&nbsp;&nbsp;&nbsp; 1 | name1&nbsp; | 12345678901234567890123456789012 | NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp; | 0000-00-00 | 2013-01-01 |<br>|&nbsp;&nbsp;&nbsp; 2 | name2&nbsp; | 12345678901234567890123456789012 | 2013-01-01 | NULL&nbsp; | 0000-00-00 | 2013-01-01 |<br>+&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+<br>2 rows in set (0.00 sec)<\/p>\n\n\n\n<p>\u770b\u5230\u6ca1\uff0c\u5c06\u589e\u52a0\u7684birth2\u5b57\u6bb5\uff0c\u5c31\u6709\u4e00\u4e2a\u9ed8\u8ba4\u503c\u4e86\uff0c\u800c\u4e14\u8fd9\u4e2a\u9ed8\u8ba4\u503c\u662f\u6211\u4eec\u624b\u5de5\u6307\u5b9a\u7684\u3002<\/p>\n\n\n\n<p>\u5173\u4e8eMySQL\u4e2d\u7ed9\u8868\u6dfb\u52a0\u4e00\u4e2a\u5b57\u6bb5\uff0c\u672c\u6587\u5c31\u4ecb\u7ecd\u8fd9\u4e48\u591a\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\uff0c\u8c22\u8c22\uff01<\/p>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4ecb\u7ecdMySQL\u6570\u636e\u5e93\u4f7f\u7528SQL\u8bed\u53e5\u6765\u5728\u73b0\u6709\u7684\u8868\u4e2d\uff0c\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5b57\u6bb5\uff0c\u5305\u62ec\u8bbe\u7f6e\u5b57\u6bb5\u7684\u662f\u5426\u4e3a\u7a7a\u3001\u9ed8\u8ba4\u503c\u7b49\u3002 \u5148 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[16],"_links":{"self":[{"href":"http:\/\/qssjx.com\/index.php?rest_route=\/wp\/v2\/posts\/66"}],"collection":[{"href":"http:\/\/qssjx.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/qssjx.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/qssjx.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/qssjx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":0,"href":"http:\/\/qssjx.com\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"wp:attachment":[{"href":"http:\/\/qssjx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/qssjx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/qssjx.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}