ÓÉMySQLÖ§³ÖµÄÁÐÀàÐÍÁÐÔÚÏÂÃæ¡£ÏÂÁдúÂë×ÖĸÓÃÓÚÃèÊöÖУº
M
Ö¸³ö×î´óµÄÏÔʾ³ß´ç¡£×î´óµÄºÏ·¨µÄÏÔʾ³ß´çÊÇ 255 ¡£
D
ÊÊÓÃÓÚ¸¡µãÀàÐͲ¢ÇÒÖ¸³ö¸úËæÔÚÊ®½øÖÆСÊýµãºóµÄÊýÂëµÄÊýÁ¿¡£×î´ó¿ÉÄܵÄÖµÊÇ30£¬µ«ÊÇÓ¦¸Ã²»´óÓÚM-2¡£
·½À¨ºÅ(¡°[¡±ºÍ¡°]¡±)Ö¸³ö¿ÉÑ¡µÄÀàÐÍÐÞÊηûµÄ²¿·Ö¡£
×¢Ò⣬Èç¹ûÄãÖ¸¶¨Ò»¸öÁËΪZEROFILL£¬MySQL½«Îª¸ÃÁÐ×Ô¶¯µØÔö¼ÓUNSIGNEDÊôÐÔ¡£
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸öºÜСµÄÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-128µ½127£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½255¡£
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸öСÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-32768µ½32767£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½65535¡£
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸öÖеȴóСÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-8388608µ½8388607£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½16777215¡£
INT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸öÕý³£´óСÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-2147483648µ½2147483647£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½4294967295¡£
INTEGER[(M)] [UNSIGNED] [ZEROFILL]
ÕâÊÇINTµÄÒ»¸öͬÒå´Ê¡£
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸ö´óÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-9223372036854775808µ½9223372036854775807£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½
18446744073709551615¡£×¢Ò⣬ËùÓÐËãÊõÔËËãÓÃÓзûºÅµÄBIGINT»òDOUBLEÖµÍê³É£¬Òò´ËÄã²»Ó¦¸ÃʹÓôóÓÚ 9223372036854775807£¨63λ)µÄÓзûºÅ´óÕûÊý£¬³ýÁËλº¯Êý£¡×¢Ò⣬µ±Á½¸ö²ÎÊýÊÇINTEGERֵʱ£¬-¡¢+ºÍ*½«Ê¹ÓÃBIGINTÔË Ë㣡ÕâÒâζ×ÅÈç¹ûÄã³Ë2¸ö´óÕûÊý(»òÀ´×ÔÓÚ·µ»ØÕûÊýµÄº¯Êý)£¬Èç¹û½á¹û´óÓÚ9223372036854775807£¬Äã¿ÉÒԵõ½ÒâÍâµÄ½á¹û¡£Ò»¸ö¸¡µãÊý ×Ö£¬²»ÄÜÊÇÎÞ·ûºÅµÄ£¬¶ÔÒ»¸öµ¥¾«¶È¸¡µãÊý£¬Æ侫¶È¿ÉÒÔÊÇ<=24£¬¶ÔÒ»¸öË«¾«¶È¸¡µãÊý£¬ÊÇÔÚ25 ºÍ53Ö®¼ä£¬ÕâЩÀàÐÍÈçFLOATºÍDOUBLEÀàÐÍÂíÉÏÔÚÏÂÃæÃèÊö¡£FLOAT(X)ÓжÔÓ¦µÄFLOATºÍDOUBLEÏàͬµÄ·¶Î§£¬µ«ÊÇÏÔʾ³ß´çºÍСÊý λÊýÊÇ䶨ÒåµÄ¡£ÔÚMySQL3.23ÖУ¬ÕâÊÇÒ»¸öÕæÕýµÄ¸¡µãÖµ¡£ÔÚ¸üÔçµÄMySQL°æ±¾ÖУ¬FLOAT(precision)×ÜÊÇÓÐ2λСÊý¡£¸Ã¾ä·¨Îª ÁËODBC¼æÈÝÐÔ¶øÌṩ¡£
FLOAT[(M,D)] [ZEROFILL]
Ò»¸öС(µ¥¾«ÃÜ)¸¡µãÊý×Ö¡£²»ÄÜÎÞ·ûºÅ¡£ÔÊÐíµÄÖµÊÇ-3.402823466E+38µ½
-1.175494351E-38£¬0
ºÍ1.175494351E-38µ½3.402823466E+38¡£MÊÇÏÔʾ¿í¶È¶øDÊÇСÊýµÄλÊý¡£Ã»ÓвÎÊýµÄFLOAT»òÓÐ<24
µÄÒ»¸ö²ÎÊý±íʾһ¸öµ¥¾«Ãܸ¡µãÊý×Ö¡£
DOUBLE[(M,D)] [ZEROFILL]
Ò»¸öÕý³£´óС(Ë«¾«ÃÜ)¸¡µãÊý×Ö¡£²»ÄÜÎÞ·ûºÅ¡£ÔÊÐíµÄÖµÊÇ
-1.7976931348623157E+308µ½-2.2250738585072014E-308¡¢
0ºÍ2.2250738585072014E-308µ½1.7976931348623157E+308¡£MÊÇÏÔʾ¿í¶È¶øDÊÇСÊýλÊý¡£Ã»ÓÐÒ»¸ö²ÎÊýµÄ
DOUBLE»òFLOAT(X)£¨25 < = X < = 53£©´ú±íÒ»¸öË«¾«Ãܸ¡µãÊý×Ö¡£
DOUBLE PRECISION[(M,D)] [ZEROFILL]
¡¡
REAL[(M,D)] [ZEROFILL]
ÕâЩÊÇDOUBLEͬÒå´Ê¡£
DECIMAL[(M[,D])] [ZEROFILL]
Ò»¸öδѹËõ(unpack)µÄ¸¡µãÊý×Ö¡£²»ÄÜÎÞ·ûºÅ¡£ÐÐΪÈçͬһ¸öCHARÁУº
¡°Î´Ñ¹Ëõ¡±Òâζ×ÅÊý×Ö×÷Ϊһ¸ö×Ö·û´®±»´æ´¢£¬ÖµµÄÿһλʹÓÃÒ»¸ö×Ö·û¡£Ð¡Êýµã£¬²¢ÇÒ¶ÔÓÚ¸ºÊý£¬¡°-¡±·ûºÅ²»ÔÚMÖмÆËã¡£Èç¹ûDÊÇ0£¬Öµ½«Ã»ÓÐСÊýµã»òСÊý
²¿·Ö¡£DECIMALÖµµÄ×î´ó·¶Î§ÓëDOUBLEÏàͬ£¬µ«ÊǶÔÒ»¸ö¸ø¶¨µÄDECIMALÁУ¬Êµ¼ÊµÄ·¶Î§¿ÉÒÔͨ¹ýMºÍDµÄÑ¡Ôñ±»ÏÞÖÆ¡£Èç¹ûD±»Ê¡ÂÔ£¬Ëü±»Éè
ÖÃΪ0¡£Èç¹ûM±»Ê¡µô£¬Ëü±»ÉèÖÃΪ10¡£×¢Ò⣬ÔÚMySQL3.22ÀM²ÎÊý°üÀ¨·ûºÅºÍСÊýµã¡£
NUMERIC(M,D) [ZEROFILL]
ÕâÊÇDECIMALµÄÒ»¸öͬÒå´Ê¡£
DATE
Ò»¸öÈÕÆÚ¡£Ö§³ÖµÄ·¶Î§ÊÇ'1000-01-01'µ½'9999-12-31'¡£MySQLÒÔ'YYYY-MM-DD'¸ñʽÀ´ÏÔʾDATEÖµ£¬µ«ÊÇÔÊÐíÄãʹÓÃ×Ö·û´®»òÊý×Ö°ÑÖµ¸³¸øDATEÁС£
DATETIME
Ò»¸öÈÕÆÚºÍʱ¼ä×éºÏ¡£Ö§³ÖµÄ·¶Î§ÊÇ'1000-01-01 00:00:00'µ½'9999-12-31
23:59:59'¡£MySQLÒÔ'YYYY-MM-DD
HH:MM:SS'¸ñʽÀ´ÏÔʾDATETIMEÖµ£¬µ«ÊÇÔÊÐíÄãʹÓÃ×Ö·û´®»òÊý×Ö°ÑÖµ¸³¸øDATETIMEµÄÁС£
TIMESTAMP[(M)]
Ò»¸öʱ¼ä´Á¼Ç¡£·¶Î§ÊÇ'1970-01-01
00:00:00'µ½2037ÄêµÄijʱ¡£MySQLÒÔYYYYMMDDHHMMSS¡¢YYMMDDHHMMSS¡¢YYYYMMDD»òYYMMDD¸ñʽÀ´ÏÔ
ʾTIMESTAMPÖµ£¬È¡¾öÓÚÊÇ·ñMÊÇ14£¨»òÊ¡ÂÔ)¡¢12¡¢8»ò6£¬µ«ÊÇÔÊÐíÄãʹÓÃ×Ö·û´®»òÊý×Ö°ÑÖµ¸³¸øTIMESTAMPÁС£Ò»¸ö
TIMESTAMPÁжÔÓڼǼһ¸öINSERT»òUPDATE²Ù×÷µÄÈÕÆÚºÍʱ¼äÊÇÓÐÓõģ¬ÒòΪÈç¹ûÄã²»×Ô¼º¸øËü¸³Öµ£¬Ëü×Ô¶¯µØ±»ÉèÖÃΪ×î½ü²Ù×÷µÄÈÕÆÚºÍʱ
¼ä¡£ÄãÒÔ¿ÉÒÔͨ¹ý¸³¸øËüÒ»¸öNULLÖµÉèÖÃËüΪµ±Ç°µÄÈÕÆÚºÍʱ¼ä¡£
TIME
Ò»¸öʱ¼ä¡£·¶Î§ÊÇ'-838:59:59'µ½'838:59:59'¡£MySQLÒÔ'HH:MM:SS'¸ñʽÀ´ÏÔʾTIMEÖµ£¬µ«ÊÇÔÊÐíÄãʹÓÃ×Ö·û´®»òÊý×Ö°ÑÖµ¸³¸øTIMEÁС£
YEAR[(2|4)]
Ò»¸ö2»ò4λÊý×Ö¸ñʽµÄÄê(ȱʡÊÇ4λ)¡£ÔÊÐíµÄÖµÊÇ1901µ½2155£¬ºÍ0000£¨4λÄê¸ñʽ£©£¬Èç¹ûÄãʹÓÃ
2룬1970-2069(
70-69)¡£MySQLÒÔYYYY¸ñʽÀ´ÏÔʾYEARÖµ£¬µ«ÊÇÔÊÐíÄã°ÑʹÓÃ×Ö·û´®»òÊý×ÖÖµ¸³¸øYEARÁС££¨YEARÀàÐÍÔÚMySQL3.22ÖÐÊÇÐÂÀà
ÐÍ¡££©
CHAR(M) [BINARY]
Ò»¸ö¶¨³¤×Ö·û´®£¬µ±´æ´¢Ê±£¬×ÜÊÇÊÇÓÿոñÌîÂúÓұߵ½Ö¸¶¨µÄ³¤¶È¡£MµÄ·¶Î§ÊÇ1 ¡«
255¸ö×Ö·û¡£µ±Öµ±»¼ìË÷ʱ£¬¿Õ¸ñβ²¿±»É¾³ý¡£CHARÖµ¸ù¾Ýȱʡ×Ö·û¼¯ÒÔ´óСд²»Çø·ÖµÄ·½Ê½ÅÅÐòºÍ±È½Ï£¬³ý·Ç¸ø³öBINARY¹Ø¼ü´Ê¡£NATIONAL
CHAR£¨¶ÌÐÎʽNCHAR)ÊÇANSI
SQLµÄ·½Ê½À´¶¨ÒåCHARÁÐÓ¦¸ÃʹÓÃȱʡ×Ö·û¼¯¡£ÕâÊÇMySQLµÄȱʡ¡£CHARÊÇCHARACTERµÄÒ»¸öËõд¡£
[NATIONAL] VARCHAR(M) [BINARY]
Ò»¸ö±ä³¤×Ö·û´®¡£×¢Ò⣺µ±Öµ±»´æ´¢Ê±£¬Î²²¿µÄ¿Õ¸ñ±»É¾³ý(ÕⲻͬÓÚ
ANSI SQL¹æ·¶)¡£MµÄ·¶Î§ÊÇ1 ¡« 255¸ö×Ö·û¡£
VARCHARÖµ¸ù¾Ýȱʡ×Ö·û¼¯ÒÔ´óСд²»Çø·ÖµÄ·½Ê½ÅÅÐòºÍ±È½Ï£¬³ý·Ç¸ø³öBINARY¹Ø¼ü´ÊÖµ¡£ VARCHARÊÇCHARACTER
VARYINGÒ»¸öËõд¡£
TINYBLOB
¡¡
TINYTEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ255(2^8-1)¸ö×Ö·û¡£
BLOB
¡¡
TEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ65535(2^16-1)¸ö×Ö·û¡£
MEDIUMBLOB
¡¡
MEDIUMTEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ16777215(2^24-1)¸ö×Ö·û¡£
LONGBLOB
¡¡
LONGTEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ4294967295(2^32-1)¸ö×Ö·û¡£
ENUM('value1','value2',...)
ö¾Ù¡£Ò»¸ö½öÓÐÒ»¸öÖµµÄ×Ö·û´®¶ÔÏó£¬Õâ¸öֵʽѡ×ÔÓëÖµÁбí'value1'¡¢'value2', ...,»òNULL¡£Ò»¸öENUM×î¶àÄÜÓÐ65535²»Í¬µÄÖµ¡£
SET('value1','value2',...)
Ò»¸ö¼¯ºÏ¡£ÄÜÓÐÁã¸ö»ò¶à¸öÖµµÄÒ»¸ö×Ö·û´®¶ÔÏó£¬ÆäÖÐÿһ¸ö±ØÐë´ÓÖµÁбí'value1', 'value2', ...Ñ¡³ö¡£Ò»¸öSET×î¶àÄÜÓÐ64¸ö³ÉÔ±¡£
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ