We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 2
In MySQL, DATE, DATETIME, and TIMESTAMP data types are:
Range of values: The DATE data type stores only
the date, while the DATETIME and TIMESTAMP data types store both the date and time. The DATETIME data type has a wider range of dates than the TIMESTAMP data type: DATE: Stores dates from 1000-01-01 to 9999-12- 31 DATETIME: Stores dates from 1000-01-01 00:00:00 to 9999-12-31 23:59:59 TIMESTAMP: Stores dates from 1970-01-01 00:00:01 UTC to 2038-01-19 03:14:07 UTC Storage size: The TIMESTAMP data type is half the size of the DATETIME data type, at 4 bytes compared to 8 bytes. Format: MySQL displays DATETIME values in the format 'YYYY-MM-DD hh:mm:ss' Time, year Data Types in MY SQL TIME Data Type :- YEAR Data type:- When to Use: When to use: Storing year information: use year Storing Time of Day: use time when when you need to store a year value. you need to store a specific time of day This is useful for historical data, birth without any date information. Examples years, event years, or any scenario include scheduling events, recording time where only the year is relevant. durations, or managing daily tasks. Date Comparisons: Suitable for filtering Time Calculations: Ideal for operations or comparing records based on the year. involving time calculations or comparisons, such as finding events that occur after a certain time. How to Use: Definition: the Year data type stores How to Use: year values in either a 2-digit or 4-digit Definition: The time data types stores format. the time values in the format HH:MM:SS Range: 1901 to 2155 (for 4-digit Range: '-838:59:59’ to '838:59:59' format) or 70 to 69 (for 2-digit format).