I want to know about temporal data types in MySQL 5. Any detail please?
MySQL provides data types for storing different kinds of temporal information. The following table summarizes the storage requirements and ranges for the date and time data types. In the following descriptions, the terms YYYY, MM, DD, hh, mm, and ss stand for a year, month, day of month, hour, minute, and second value, respectively:
Type |
Storage Required |
Range |
DATE |
3 bytes |
'1000-01-01' to '9999-12-31' |
TIME |
3 bytes |
'-838:59:59' to '838:59:59' |
DATETIME |
8 bytes |
'1000-01-01 00:00:00' to '9999-12-31 23:59:59' |
TIMESTAMP |
4 bytes |
'1970-01-01 00:00:00' to mid-year 2037 |
YEAR |
1 byte |
1901 to 2155 (for YEAR(4)), 1970 to 2069 (for YEAR(2)) |
Each temporal data type also has a "zero" value that's used when you attempt to store an illegal value. The "zero" value is represented in a format appropriate for the type (such as '0000-00-00' for DATE values and '00:00:00' for TIME) values. MySQL represents date values in 'YYYY-MM-DD' format and time values in 'hh:mm:ss' format when it displays them.