|
|
|
|
| |
Date and Time Column Types
MySQL provides several column types for temporal values—DATE, DATETIME, TIME, TIMESTAMP, and YEAR. Table 2.10 shows the types provided by MySQL for declaring columns that hold date and time values and the range of legal values for each type. The storage requirements for each type are shown in Table 2.11.
Table 2.10. Date and Time Column Types
| Type Specification |
Range |
| DATE |
'1000-01-01' to '9999-12-31' |
| TIME |
'-838:59:59' to '838:59:59' |
| DATETIME |
'1000-01-01 00:00:00' to '9999-12-31 23:59:59' |
| TIMESTAMP[(M)] |
19700101000000 to sometime in the year 2037 |
| YEAR[(M)] |
1901 to 2155 for YEAR(4), and 1970 to 2069 for YEAR(2) |
Table 2.11. Date and Time Column Type Storage Requirements
| Type Specification |
Storage Required |
| DATE |
3 bytes (4 bytes prior to MySQL 3.22) |
| TIME |
3 bytes |
| DATETIME |
8 bytes |
| TIMESTAMP |
4 bytes |
| YEAR |
1 byte |
Each date and time type has a "zero" value that is stored when you insert a value that is illegal for the type, as shown in Table 2.12. This value is also the default value for date and time columns that are declared NOT NULL.
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|