Overview
TheDATE
data type is used to store and insert date values.
The date value is stored without the time zone.
Structure
The date type contains three components: year, month, and day. It’s represented in a 32-bit integer. Here is the breakdown:- Day component: 5 bits store the number of days within a month. Its value is in the range
<1, 31>
. - Month component: 4 bits store the month of the year. Its value is in the range
<1, 12>
. - Year component: 23 bits store the number of years. Its value is from range
<0, 2^23 - 1>
.
Format
YYYY
- Four-digit yearMM
- One / two-digit monthDD
- One / two-digit day
Example
In this example, we will create an emp_submission table that consists of the candidate ID, candidate name, the submitted department, and a submission date with aDATE
data type.
SELECT
statement below:
SELECT
statement where the values in the sub_date
column have DATE
data type: