MySql has the following datatypes :
MySQL supports the SQL standard integer types INTEGER (or INT) and SMALLINT. As an extension to the standard, MySQL also supports the integer types TINYINT, MEDIUMINT, and BIGINT. The following table shows the required storage and range for each integer type.
Type |
Storage (Bytes) |
Minimum Value (Signed/Unsigned) |
Maximum Value (Signed/Unsigned) |
---|---|---|---|
TINYINT | 1 | -128 | 127 |
0 | 255 | ||
SMALLINT | 2 | -32768 | 32767 |
0 | 65535 | ||
MEDIUMINT | 3 | -8388608 | 8388607 |
0 | 16777215 | ||
INT | 4 | -2147483648 | 2147483647 |
0 | 4294967295 | ||
BIGINT | 8 | -9223372036854775808 | 9223372036854775807 |
0 | 18446744073709551615 |
MySQL Datatype | Length | Default value(if not null) |
---|---|---|
FLOAT | 32 Bit Floating Point | 0 |
DOUBLE | 64 Bit Floating Point | 0 |
MySQL Datatype | Length | Default value(if not null) |
---|---|---|
CHAR | 1 to 255 Characters | space |
VARCHAR | 1 to 255 Characters | space |
The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you want to store. For example, CHAR(30) can hold up to 30 characters.
* The CHAR and VARCHAR types are similar, but differ in the way they are stored and retrieved.
* The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255. When CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed.
* VARCHAR values are not padded when they are stored. Handling of trailing spaces is version-dependent.
MySQL Datatype | Length | Default value(if not null) |
---|---|---|
TEXT | 1 to 65535 Characters | space |
MySQL Datatype | Length | Default value(if not null) |
---|---|---|
DATE | 1 to 4,294,967,295 Bytes | 0000-00-00 |
DATETIME | 1 to 4,294,967,295 Bytes | 0000-00-00 00:00:00 |