. .

MySQL

» PHP » MySQL » MySQL

. , . , .

, - , - . . , , , , .

MySQL , : , (). , .

. , , , . . , , .

, MySQL, . :

. . 255. , .

D. . . 30, , -2.

([ ]) , .

, , ZEROFILL, MySQL UNSIGNED.


TINYINT[()] [UNSIGNED] [ZER0FILL]

. -128 127. 0 255.


SMALLINT[()] [UNSIGNED] [ZER0FILL]

. -32768 32767. 0 65535.


MEDIUMINT[()] [UNSIGNED] [ZEROFILL]

. -8388608 8388607. 0 16777215.


INT[()] [UNSIGNED] [ZEROFILL]

. -2147483648 2147483647. 0 4294967295.


INTEGER[()] [UNSIGNED] [ZER0FILL]

INT.


BIGINT[()] [UNSIGNED] [ZEROFILL]

. -9223372036854775808 9223372036854775807. 0 18446744073709551615.

, BIGINT:

  • BIGINT DOUBLE, , , 9223372036854775807 (63 ) ! , - BIGINT DOUBLE;
  • BIGINT, , ;
  • MySQL 4.0 , BIGINT;
  • -, + * BIGINT, INTEGER. , ( , ), , , 9223372036854775807.

FLOAT(precision) [ZEROFILL]

. . (precision) <=24, , 25 53, . FLOAT DOUBLE, . FLOAT(X) , FLOAT DOUBLE, . MySQL 3.23 .

MySQL FLOAT(precision) 2 . , FLOAT , MySQL .


FLOAT[(,D)] [ZEROFILL]

( ) . . -3.402823466+38 -1.175494351-38, 0 1.175494351-38 3.402823466+38. , a D . FLOAT (X), X <= 24.


DOUBLE[(M,D)] [ZEROFILL]

( ) . . -1.7976931348623157+308 -2.2250738585072014-308, 0 2.2250738585072014-308 1.7976931348623157+308. , a D - . DOUBLE FLOAT(X), 25 <= X <= 53.


DOUBLE PRECISION[(M,D)] [ZEROFILL] MREAL[(M,D)] [ZEROFILL]

DOUBLE.


DECIMAL[(M[,D])] [ZEROFILL]

. ! CHAR: , . ( ). D=0, . DECIMAL DOUBLE, DECIMAL D.

D , 0. , 10. , MySQL 3.22 , .


NUMERIC(,D) [ZEROFILL]

DECIMAL.


DATE

. : 1000-01-01 9999-12-31. MySQL DATE (YY) YY-MM-DD, DATE, .


DATETIME

. : 1000-01-01 00:00:00 9999-12-31 23:59:59. MySQL DATETIME (YY) YY-MM-DD :: SS, DATETIME, .


TIMESTAMP[()]

. : 1970-01-01 00:00:00 2037. MySQL TIMESTAMP (YY) YY-MM-DD HH:MM:SS, YY-MM-DD ::SS, (YY)YY-MM-DD YY-MM-DD, : 14 ( ), 12, 8 , TIMESTAMP, .

TIMESTAMP INSERT UPDATE, , . , NULL.

TIMESTAMP 4 . , TIMESTAMP. , TIMESTAMP (X) X, 8 14, , TIMESTAMP (X) !


TIME

. : -838:59:59 838:59:59. MySQL TIME HH:MM:SS, TIME, .


YEAR[(2|4)]

( 4). : 1901 2155, 0000 4 1970-2069, 2 (70-69). MySQL YEAR YYYY, YEAR, . YEAR MySQL 3.22.


[NATIONAL] CHAR() [BINARY]

, . 1 255 . , . CHAR , BINARY. NATIONAL CHAR ( NCHAR) ANSI SQL , CHAR CHARACTER. MySQL.

CHAR CHARACTER. MySQL CHAR(0). , , , . , , 2 : CHAR(0), NOT NULL, 2 : NULL ( ).


[NATIONAL] VARCHAR() [BINARY]

( ").

, ( ANSI SQL). 1 255 . VARCHAR , , BINARY. VARCHAR CHARACTER VARYING.


TINYBLOB TINYTEXT

TINYBLOB TINYTEXT 255 (2∧8-1) .


BLOB TEXT

BLOB TEXT 65535 (2∧16-1) .


MEDIUMBLOB MEDIUMTEXT

MEDIUMBLOB MEDIUMTEXT 16777215 (2∧24-1) .


LONGBLOB LONGTEXT

LONGBLOB LONGTEXT 4294967295 (2∧32-1) . , - 16 , .


ENUM("valuel",'value2',...)

. , , valuel, value2, ..., NULL . ENUM 65535 .


SET("valuel",'value2',...)

. , , valuel, value2, .... SET, 64 .