-- Create a new table from scratch
CREATE TABLE `itsadate` (
-- Let us have the database provide a unique key
`dateExID` INT(5) AUTO_INCREMENT,
-- The name of the object
`dateName` VARCHAR(15) NOT NULL,
-- Add one line for each field in the table
`dtDate0` DATETIME NOT NULL,
`dtDate1` DATETIME NOT NULL,
`tsDate` TIMESTAMP NOT NULL,
`dDate` DATE NOT NULL,
`tDate` TIME NOT NULL,
`ytDate` YEAR(4) NOT NULL,
-- Indicate the primary key for this table
PRIMARY KEY(`dateExID`)
);
-- Populate additional data into table
INSERT INTO `itsadate` VALUES
(NULL,'Early Start ','2022-09-04 00:00:00','2022-09-04 12:00:00','2022-09-04 00:00:00','2022-09-04','00:00:00','2022'),
(NULL,'Early Finish ','2022-09-04 00:00:00','2022-09-04 12:00:00','2022-09-04 00:00:00','2022-09-04','00:00:00','2022'),
(NULL,'Late Start ','2022-09-04 00:00:00','2022-09-04 12:00:00','2022-09-04 00:00:00','2022-09-04','00:00:00','2022'),
(NULL,'Late Finish ','2022-09-04 00:00:00','2022-09-04 12:00:00','2022-09-04 00:00:00','2022-09-04','00:00:00','2022');
I created a Table of Dates here so we could play around with them and see how they react
This is one of 2 DATETIME Variables in this table
The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'
DATETIME Data Type Example