Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

SQL DATE return not giving what I INSERTED in the Table

$
0
0

So I have created a table in SQL

I get the same result on 2 different online SQL website IDE I was given to use.

https://sqliteonline.com/

and

https://www.jdoodle.com/execute-sql-online/

As you can see on the select query I enter the dates that I get returned are not the ones I inserted. Am I doing something wrong? I'm new to SQL and this is a learning project

CREATE TABLE student (    STU_NUM CHAR(6),    STU_SNAME VARCHAR(15),    STU_FNAME VARCHAR(15),    STU_INITIAL CHAR(1),    STU_STARTDATE DATE,    COURSE_CODE CHAR(3),    PROJ_NUM INT(2),    PRIMARY KEY (STU_NUM));

and then I insert the data in it in this format:

INSERT INTO studentVALUES ('01', 'Snow', 'Jon', 'E', 2014-04-05, 201, 6),        ('02', 'Stark', 'Arya', 'C', 2017-07-12, 305, 11),        ('03', 'Lannister', 'James', 'C', 2012-09-05, 101, 2),        ('04', 'Lannister', 'Cercei', 'J', 2012-09-05, 101, 2),        ('05', 'Greyjoy', 'Theon', 'I', 2015-12-09, 402, 14),        ('06', 'Tyrell', 'Margaery', 'Y', 2017-07-12, 305, 10),        ('07', 'Baratheon', 'Tommen', 'R', 2019-06-13, 201, 5);

However when I do a return on the database the dates are all messed up

SELECT * FROM student

I get:

        01|Snow|Jon|E|2005|201|6        02|Stark|Arya|C|1998|305|11        03|Lannister|James|C|1998|101|2        04|Lannister|Cercei|J|1998|101|2        05|Greyjoy|Theon|I|1994|402|14        06|Tyrell|Margaery|Y|1998|305|10        07|Baratheon|Tommen|R|2000|201|5

I tried to retrieve all the data from the table expecting a DATE format to be in the form I entered id: YYYY-MM-DD


Viewing all articles
Browse latest Browse all 12111

Trending Articles