{"id":1697,"date":"2017-01-23T15:53:34","date_gmt":"2017-01-23T07:53:34","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=1697"},"modified":"2017-01-23T15:53:34","modified_gmt":"2017-01-23T07:53:34","slug":"mysql-%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/mysql-%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b\/","title":{"rendered":"MySQL \u6570\u636e\u7c7b\u578b"},"content":{"rendered":"<p>MySQL\u4e2d\u5b9a\u4e49\u6570\u636e\u5b57\u6bb5\u7684\u7c7b\u578b\u5bf9\u4f60\u6570\u636e\u5e93\u7684\u4f18\u5316\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n<p>MySQL\u652f\u6301\u591a\u79cd\u7c7b\u578b\uff0c\u5927\u81f4\u53ef\u4ee5\u5206\u4e3a\u4e09\u7c7b\uff1a\u6570\u503c\u3001\u65e5\u671f\/\u65f6\u95f4\u548c\u5b57\u7b26\u4e32(\u5b57\u7b26)\u7c7b\u578b\u3002<\/p>\n<hr \/>\n<h2>\u6570\u503c\u7c7b\u578b<\/h2>\n<p>MySQL\u652f\u6301\u6240\u6709\u6807\u51c6SQL\u6570\u503c\u6570\u636e\u7c7b\u578b\u3002<\/p>\n<p>\u8fd9\u4e9b\u7c7b\u578b\u5305\u62ec\u4e25\u683c\u6570\u503c\u6570\u636e\u7c7b\u578b(INTEGER\u3001SMALLINT\u3001DECIMAL\u548cNUMERIC)\uff0c\u4ee5\u53ca\u8fd1\u4f3c\u6570\u503c\u6570\u636e\u7c7b\u578b(FLOAT\u3001REAL\u548cDOUBLE PRECISION)\u3002<\/p>\n<p>\u5173\u952e\u5b57INT\u662fINTEGER\u7684\u540c\u4e49\u8bcd\uff0c\u5173\u952e\u5b57DEC\u662fDECIMAL\u7684\u540c\u4e49\u8bcd\u3002<\/p>\n<p>BIT\u6570\u636e\u7c7b\u578b\u4fdd\u5b58\u4f4d\u5b57\u6bb5\u503c\uff0c\u5e76\u4e14\u652f\u6301MyISAM\u3001MEMORY\u3001InnoDB\u548cBDB\u8868\u3002<\/p>\n<p>\u4f5c\u4e3aSQL\u6807\u51c6\u7684\u6269\u5c55\uff0cMySQL\u4e5f\u652f\u6301\u6574\u6570\u7c7b\u578bTINYINT\u3001MEDIUMINT\u548cBIGINT\u3002\u4e0b\u9762\u7684\u8868\u663e\u793a\u4e86\u9700\u8981\u7684\u6bcf\u4e2a\u6574\u6570\u7c7b\u578b\u7684\u5b58\u50a8\u548c\u8303\u56f4\u3002<\/p>\n<table class=\"reference\">\n<tbody>\n<tr>\n<th width=\"10%\"><strong>\u7c7b\u578b <\/strong><\/th>\n<th width=\"15%\"><strong>\u5927\u5c0f <\/strong><\/th>\n<th width=\"30%\"><strong>\u8303\u56f4\uff08\u6709\u7b26\u53f7\uff09 <\/strong><\/th>\n<th width=\"30%\"><strong>\u8303\u56f4\uff08\u65e0\u7b26\u53f7\uff09 <\/strong><\/th>\n<th width=\"15%\"><strong>\u7528\u9014 <\/strong><\/th>\n<\/tr>\n<tr>\n<td>TINYINT<\/td>\n<td>1 \u5b57\u8282<\/td>\n<td>(-128\uff0c127)<\/td>\n<td>(0\uff0c255)<\/td>\n<td>\u5c0f\u6574\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>SMALLINT<\/td>\n<td>2 \u5b57\u8282<\/td>\n<td>(-32 768\uff0c32 767)<\/td>\n<td>(0\uff0c65 535)<\/td>\n<td>\u5927\u6574\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>MEDIUMINT<\/td>\n<td>3 \u5b57\u8282<\/td>\n<td>(-8 388 608\uff0c8 388 607)<\/td>\n<td>(0\uff0c16 777 215)<\/td>\n<td>\u5927\u6574\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>INT\u6216INTEGER<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>(-2 147 483 648\uff0c2 147 483 647)<\/td>\n<td>(0\uff0c4 294 967 295)<\/td>\n<td>\u5927\u6574\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>BIGINT<\/td>\n<td>8 \u5b57\u8282<\/td>\n<td>(-9 233 372 036 854 775 808\uff0c9 223 372 036 854 775 807)<\/td>\n<td>(0\uff0c18 446 744 073 709 551 615)<\/td>\n<td>\u6781\u5927\u6574\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>FLOAT<\/td>\n<td>4 \u5b57\u8282<\/td>\n<td>(-3.402 823 466 E+38\uff0c-1.175 494 351 E-38)\uff0c0\uff0c(1.175 494 351 E-38\uff0c3.402 823 466 351 E+38)<\/td>\n<td>0\uff0c(1.175 494 351 E-38\uff0c3.402 823 466 E+38)<\/td>\n<td>\u5355\u7cbe\u5ea6<br \/>\n\u6d6e\u70b9\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>DOUBLE<\/td>\n<td>8 \u5b57\u8282<\/td>\n<td>(-1.797 693 134 862 315 7 E+308\uff0c-2.225 073 858 507 201 4 E-308)\uff0c0\uff0c(2.225 073 858 507 201 4 E-308\uff0c1.797 693 134 862 315 7 E+308)<\/td>\n<td>0\uff0c(2.225 073 858 507 201 4 E-308\uff0c1.797 693 134 862 315 7 E+308)<\/td>\n<td>\u53cc\u7cbe\u5ea6<br \/>\n\u6d6e\u70b9\u6570\u503c<\/td>\n<\/tr>\n<tr>\n<td>DECIMAL<\/td>\n<td>\u5bf9DECIMAL(M,D) \uff0c\u5982\u679cM&gt;D\uff0c\u4e3aM+2\u5426\u5219\u4e3aD+2<\/td>\n<td>\u4f9d\u8d56\u4e8eM\u548cD\u7684\u503c<\/td>\n<td>\u4f9d\u8d56\u4e8eM\u548cD\u7684\u503c<\/td>\n<td>\u5c0f\u6570\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u65e5\u671f\u548c\u65f6\u95f4\u7c7b\u578b<\/h2>\n<p>\u8868\u793a\u65f6\u95f4\u503c\u7684\u65e5\u671f\u548c\u65f6\u95f4\u7c7b\u578b\u4e3aDATETIME\u3001DATE\u3001TIMESTAMP\u3001TIME\u548cYEAR\u3002<\/p>\n<p>\u6bcf\u4e2a\u65f6\u95f4\u7c7b\u578b\u6709\u4e00\u4e2a\u6709\u6548\u503c\u8303\u56f4\u548c\u4e00\u4e2a&#8221;\u96f6&#8221;\u503c\uff0c\u5f53\u6307\u5b9a\u4e0d\u5408\u6cd5\u7684MySQL\u4e0d\u80fd\u8868\u793a\u7684\u503c\u65f6\u4f7f\u7528&#8221;\u96f6&#8221;\u503c\u3002<\/p>\n<p>TIMESTAMP\u7c7b\u578b\u6709\u4e13\u6709\u7684\u81ea\u52a8\u66f4\u65b0\u7279\u6027\uff0c\u5c06\u5728\u540e\u9762\u63cf\u8ff0\u3002<\/p>\n<table class=\"reference\">\n<tbody>\n<tr>\n<th width=\"10%\">\u7c7b\u578b<\/th>\n<th width=\"10%\">\u5927\u5c0f<br \/>\n(\u5b57\u8282)<\/th>\n<th width=\"40%\">\u8303\u56f4<\/th>\n<th>\u683c\u5f0f<\/th>\n<th>\u7528\u9014<\/th>\n<\/tr>\n<tr>\n<td width=\"10%\">DATE<\/td>\n<td width=\"10%\">3<\/td>\n<td width=\"40%\">1000-01-01\/9999-12-31<\/td>\n<td>YYYY-MM-DD<\/td>\n<td>\u65e5\u671f\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"10%\">TIME<\/td>\n<td width=\"10%\">3<\/td>\n<td width=\"40%\">&#8216;-838:59:59&#8217;\/&#8217;838:59:59&#8217;<\/td>\n<td>HH:MM:SS<\/td>\n<td>\u65f6\u95f4\u503c\u6216\u6301\u7eed\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td width=\"10%\">YEAR<\/td>\n<td width=\"10%\">1<\/td>\n<td width=\"40%\">1901\/2155<\/td>\n<td>YYYY<\/td>\n<td>\u5e74\u4efd\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"10%\">DATETIME<\/td>\n<td width=\"10%\">8<\/td>\n<td width=\"40%\">1000-01-01 00:00:00\/9999-12-31 23:59:59<\/td>\n<td>YYYY-MM-DD HH:MM:SS<\/td>\n<td>\u6df7\u5408\u65e5\u671f\u548c\u65f6\u95f4\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"10%\">TIMESTAMP<\/td>\n<td width=\"10%\">4<\/td>\n<td width=\"40%\">1970-01-01 00:00:00\/2037 \u5e74\u67d0\u65f6<\/td>\n<td>YYYYMMDD HHMMSS<\/td>\n<td>\u6df7\u5408\u65e5\u671f\u548c\u65f6\u95f4\u503c\uff0c\u65f6\u95f4\u6233<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u5b57\u7b26\u4e32\u7c7b\u578b<\/h2>\n<p>\u5b57\u7b26\u4e32\u7c7b\u578b\u6307CHAR\u3001VARCHAR\u3001BINARY\u3001VARBINARY\u3001BLOB\u3001TEXT\u3001ENUM\u548cSET\u3002\u8be5\u8282\u63cf\u8ff0\u4e86\u8fd9\u4e9b\u7c7b\u578b\u5982\u4f55\u5de5\u4f5c\u4ee5\u53ca\u5982\u4f55\u5728\u67e5\u8be2\u4e2d\u4f7f\u7528\u8fd9\u4e9b\u7c7b\u578b\u3002<\/p>\n<table class=\"reference\">\n<tbody>\n<tr>\n<th width=\"20%\">\u7c7b\u578b<\/th>\n<th width=\"25%\">\u5927\u5c0f<\/th>\n<th width=\"55%\">\u7528\u9014<\/th>\n<\/tr>\n<tr>\n<td>CHAR<\/td>\n<td>0-255\u5b57\u8282<\/td>\n<td>\u5b9a\u957f\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td>VARCHAR<\/td>\n<td>0-65535 \u5b57\u8282<\/td>\n<td>\u53d8\u957f\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td>TINYBLOB<\/td>\n<td>0-255\u5b57\u8282<\/td>\n<td>\u4e0d\u8d85\u8fc7 255 \u4e2a\u5b57\u7b26\u7684\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td>TINYTEXT<\/td>\n<td>0-255\u5b57\u8282<\/td>\n<td>\u77ed\u6587\u672c\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td>BLOB<\/td>\n<td>0-65 535\u5b57\u8282<\/td>\n<td>\u4e8c\u8fdb\u5236\u5f62\u5f0f\u7684\u957f\u6587\u672c\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>TEXT<\/td>\n<td>0-65 535\u5b57\u8282<\/td>\n<td>\u957f\u6587\u672c\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>MEDIUMBLOB<\/td>\n<td>0-16 777 215\u5b57\u8282<\/td>\n<td>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e8c\u8fdb\u5236\u5f62\u5f0f\u7684\u4e2d\u7b49\u957f\u5ea6\u6587\u672c\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>MEDIUMTEXT<\/td>\n<td>0-16 777 215\u5b57\u8282<\/td>\n<td>\u4e2d\u7b49\u957f\u5ea6\u6587\u672c\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>LONGBLOB<\/td>\n<td>0-4 294 967 295\u5b57\u8282<\/td>\n<td>\u4e8c\u8fdb\u5236\u5f62\u5f0f\u7684\u6781\u5927\u6587\u672c\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>LONGTEXT<\/td>\n<td>0-4 294 967 295\u5b57\u8282<\/td>\n<td>\u6781\u5927\u6587\u672c\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>CHAR\u548cVARCHAR\u7c7b\u578b\u7c7b\u4f3c\uff0c\u4f46\u5b83\u4eec\u4fdd\u5b58\u548c\u68c0\u7d22\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5b83\u4eec\u7684\u6700\u5927\u957f\u5ea6\u548c\u662f\u5426\u5c3e\u90e8\u7a7a\u683c\u88ab\u4fdd\u7559\u7b49\u65b9\u9762\u4e5f\u4e0d\u540c\u3002\u5728\u5b58\u50a8\u6216\u68c0\u7d22\u8fc7\u7a0b\u4e2d\u4e0d\u8fdb\u884c\u5927\u5c0f\u5199\u8f6c\u6362\u3002<\/p>\n<p>BINARY\u548cVARBINARY\u7c7b\u7c7b\u4f3c\u4e8eCHAR\u548cVARCHAR\uff0c\u4e0d\u540c\u7684\u662f\u5b83\u4eec\u5305\u542b\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\u800c\u4e0d\u8981\u975e\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b83\u4eec\u5305\u542b\u5b57\u8282\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u5b57\u7b26\u5b57\u7b26\u4e32\u3002\u8fd9\u8bf4\u660e\u5b83\u4eec\u6ca1\u6709\u5b57\u7b26\u96c6\uff0c\u5e76\u4e14\u6392\u5e8f\u548c\u6bd4\u8f83\u57fa\u4e8e\u5217\u503c\u5b57\u8282\u7684\u6570\u503c\u503c\u3002<\/p>\n<p>BLOB\u662f\u4e00\u4e2a\u4e8c\u8fdb\u5236\u5927\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5bb9\u7eb3\u53ef\u53d8\u6570\u91cf\u7684\u6570\u636e\u3002\u67094\u79cdBLOB\u7c7b\u578b\uff1aTINYBLOB\u3001BLOB\u3001MEDIUMBLOB\u548cLONGBLOB\u3002\u5b83\u4eec\u53ea\u662f\u53ef\u5bb9\u7eb3\u503c\u7684\u6700\u5927\u957f\u5ea6\u4e0d\u540c\u3002<\/p>\n<p>\u67094\u79cdTEXT\u7c7b\u578b\uff1aTINYTEXT\u3001TEXT\u3001MEDIUMTEXT\u548cLONGTEXT\u3002\u8fd9\u4e9b\u5bf9\u5e944\u79cdBLOB\u7c7b\u578b\uff0c\u6709\u76f8\u540c\u7684\u6700\u5927\u957f\u5ea6\u548c\u5b58\u50a8\u9700\u6c42\u3002<\/p>\n<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/www.runoob.com\/mysql\/mysql-data-types.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u4e2d\u5b9a\u4e49\u6570\u636e\u5b57\u6bb5\u7684\u7c7b\u578b\u5bf9\u4f60\u6570\u636e\u5e93\u7684\u4f18\u5316\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002 MySQL\u652f\u6301\u591a\u79cd\u7c7b\u578b\uff0c\u5927\u81f4\u53ef\u4ee5\u5206\u4e3a\u4e09\u7c7b\uff1a\u6570\u503c\u3001 &#8230; <a title=\"MySQL \u6570\u636e\u7c7b\u578b\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/mysql-%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b\/\" aria-label=\"\u9605\u8bfb MySQL \u6570\u636e\u7c7b\u578b\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,10],"tags":[45],"class_list":["post-1697","post","type-post","status-publish","format-standard","hentry","category-jishu","category-shujuku","tag-mysql"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=1697"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1697\/revisions"}],"predecessor-version":[{"id":1698,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/1697\/revisions\/1698"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=1697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=1697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=1697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}