First page Back Continue Last page Image

-- 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');

We are back in the Time Table

As a starting place here is several of each date type entered into fields in a table

Time And Date Data Type Examples