www.PHPBuddy.com
 PHP Function Lookup:
 
Categories
PHP Quick Start
PHP Installation
PHP Articles
PHP Scripts

Top Rated Articles 

Site Related
Submit Articles/Code
Contact Us
Home

   Home                   Article Added on: March 29, 2002
Data Types in Mysql

Overview: The different types of datatypes that are available to MySQL database with there range.

Data Types in MySQL

TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.

SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535.

MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-size integer. The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.

INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295.

INTEGER[(M)] [UNSIGNED] [ZEROFILL]
This is a synonym for INT.

BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.

FLOAT[(M,D)] [ZEROFILL]
A small (single-precision) floating-point number. Cannot be unsigned. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38. The M is the display width and D is the number of decimals. FLOAT without an argument or with an argument of <= 24 stands for a single-precision floating-point number.

DOUBLE[(M,D)] [ZEROFILL]
A normal-size (double-precision) floating-point number. Cannot be unsigned. Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308. The M is the display width and D is the number of decimals. DOUBLE without an argument or FLOAT(X) where 25 <= X <= 53 stands for a double-precision floating-point number.

DATE: A date. The supported range is '1000-01-01' to '9999-12-31'. MySQL displays DATE values in 'YYYY-MM-DD' format, but allows you to assign values to DATE columns using either strings or numbers. See section 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types.

DATETIME
A date and time combination. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. MySQL displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format, but allows you to assign values to DATETIME columns using either strings or numbers. See section 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types.

TIMESTAMP[(M)]
A timestamp. The range is '1970-01-01 00:00:00' to sometime in the year 2037. MySQL displays TIMESTAMP values in YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD, or YYMMDD format.

TIME
A time. The range is '-838:59:59' to '838:59:59'. MySQL displays TIME values in 'HH:MM:SS' format.

YEAR[(2|4)]
A year in 2- or 4-digit format (default is 4-digit). The allowable values are 1901 to 2155.

CHAR
These three are synonyms for CHAR(1).

VARCHAR(M)
A variable-length string. NOTE: Trailing spaces are removed when the value is stored The range of M is 1 to 255 characters.

TINYBLOB, TINYTEXT
A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters.

BLOB, TEXT
A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters.

MEDIUMBLOB, MEDIUMTEXT
A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters.

LONGBLOB, LONGTEXT
A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters.

 
Rate this article:  Current Rating: 1.50
  Poor    Excellent     
          1     2    3    4    5

 

Home | Privacy Policy | Contact Us | Terms of Service
(c) 2002 - 2018 www.PHPbuddy.com Unauthorized reproduction/replication of any part of this site is prohibited.