MySQL Data Types
Last Updated: 2005-12-11
String Data Types
- The string data types can be used to store standard characters that use a single byte of storage or Unicode characters that use two bytes of storage.
- The Unicode specification is s scheme that's used to encode characters used in languages around the world.
- The char and nchar data types are typically used for fixed-length strings. These data types use only the amount of storage regardless of the actual lenght of the string.
- The varchar and nvarchar data types are typically used for variable-length strings. These data types use only the amount of storage needed for a given string.
- Since the world is now interconnected by the internet, the use of Unicode is highly recommended to ensure language support.
CHAR( ) A fixed section from 0 to 255 characters long.
VARCHAR( ) A variable section from 0 to 255 characters long.
TINYTEXT A string with a maximum length of 255 characters.
TEXT A string with a maximum length of 65535 characters.
BLOB A string with a maximum length of 65535 characters.
MEDIUMTEXT A string with a maximum length of 16777215 characters.
MEDIUMBLOB A string with a maximum length of 16777215 characters.
LONGTEXT A string with a maximum length of 4294967295 characters.
LONGBLOB A string with a maximum length of 4294967295 characters.
Numeric Data Types
- The integer data types are used to store whole numbers without any digits to the right of the decimal point.
- The decimal data types are used to store decimal values, which can include digits to the right of the cemial point.
- The precision of a decimal value indicates the total number of digits that can be stored.
The scale of a decimal value indicates the number of digits that can be stored to the right of the decimal point.
- The integer and decimal data types are considered excat numeric data types because their precision is exact.
- The real data types are used to store floating-point numbers, which have a limited number of significant digits.
- The real data types are considered approcimate numeric data types because they may not represent a value exactly.
TINYINT( ) -128 to 127 normal 0 to 255 UNSIGNED.
SMALLINT( ) -32768 to 32767 normal 0 to 65535 UNSIGNED.
MEDIUMINT( ) -8388608 to 8388607 normal 0 to 16777215 UNSIGNED.
INT( ) -2147483648 to 2147483647 normal 0 to 4294967295 UNSIGNED.
BIGINT( ) -9223372036854775808 to 9223372036854775807 normal 0 to 18446744073709551615 UNSIGNED.
FLOAT A small number with a floating decimal point.
DOUBLE( , ) A large number with a floating decimal point.
DECIMAL( , ) A DOUBLE stored as a string , allowing for a fixed decimal point.
Date/Time Data Types
DATE YYYY-MM-DD.
DATETIME YYYY-MM-DD HH:MM:SS.
TIMESTAMP YYYYMMDDHHMMSS.
TIME HH:MM:SS.
Last update by Skylinux @ 2005-12-1 22:52:04
- Added some descriptions
Last update by Skylinux @ 2005-12-11 10:36:44
No Comments yet .....
Add Your Comment:
Note: All posts require administrator approval. Please allow 24 hours for message approval.