Matt Hawkins
Matt Hawkins

Reputation: 29

MySQL DATE returning some blank values but not all

Essentially MySQL server is returning some empty values for the data that I have inserted, anyone know why + how to fix?

Table:

CREATE TABLE DRIVER (
  dr_ID INT NOT NULL,
  dr_title VARCHAR(15) NOT NULL,
  dr_fname VARCHAR(45) NOT NULL,
  dr_lname VARCHAR(45) NOT NULL,
  dr_DOB DATE NOT NULL,
  dr_licenceNo VARCHAR(45) NOT NULL,
  dr_phone VARCHAR(15) NOT NULL,
  dr_email VARCHAR(45) NOT NULL,
PRIMARY KEY (dr_ID));

Insert Data:

  INSERT INTO DRIVER VALUES(1, 'TITLE1', 'Jim', 'Gregory', '1982-17-02', '0123456', '02135456852', '[email protected]');
  INSERT INTO DRIVER VALUES(2, 'TITLE2', 'Jeff', 'Green', '1992-13-02', '0322351', '02431256851', '[email protected]');
  INSERT INTO DRIVER VALUES(3, 'TITLE3', 'Jimmy', 'Bates', '1979-30-06', '0523156', '03235456852', '[email protected]');
  INSERT INTO DRIVER VALUES(4, 'TITLE4', 'James', 'Bedding', '1981-22-07', '5123452', '04355456853', '[email protected]');
  INSERT INTO DRIVER VALUES(5, 'TITLE5', 'Jeffrey', 'Trout', '1969-11-08', '8132451', '02135476852', '[email protected]');
  INSERT INTO DRIVER VALUES(6, 'TITLE6', 'Jem', 'Bartler', '1991-02-01', '3423456', '04155758850', '[email protected]');
  INSERT INTO DRIVER VALUES(7, 'TITLE7', 'Jeud', 'Flemming', '1988-04-03', '2123443', '02534456852', '[email protected]');
  INSERT INTO DRIVER VALUES(8, 'TITLE8', 'Jedd', 'Dawkins', '1993-07-12', '8675643', '02112356853', '[email protected]');
  INSERT INTO DRIVER VALUES(9, 'TITLE9', 'John', 'Silver', '1976-23-11', '0985743', '02176326854', '[email protected]');
  INSERT INTO DRIVER VALUES(10, 'TITLE10', 'Derek', 'Brown', '1985-12-05', '5123453', '02432656852', '[email protected]');

The following is the result from MySQL Server:

enter image description here

For some reason some of the fields have the data and some do not. Why is this?

Upvotes: 0

Views: 25

Answers (1)

Sathiesh
Sathiesh

Reputation: 419

The format is yyyy-mm-dd. The samples that are invalid have a month value more than 12.

Upvotes: 4

Related Questions