date Date variable

Sweatysven

An error appears in the 'exams' table, because of the date Date variable - I've searched nearly everywhere (using Google) for an answer.

Drop table if exists exams;
CREATE TABLE administration2.exams (
date DATE,
censor VARCHAR(45) ,
idstudents VARCHAR(11),
idcourses VARCHAR(11),
grade INT (11),
PRIMARY KEY (date,censor));

insert into exams(date, censor, idstudents, idcourses, grade)
('2013-11-06', 'Ole Pedersen','201210066', 'dDB', 7),

Here is the problem ('2013-11-06') - it says:

`syntax_error, UNEXPECTED TEXT_STRING, expecting SELECT_SYM.

How do I fix this?

Gordon Linoff

You are missing the values statement:

insert into exams(date, censor, idstudents, idcourses, grade)
    values ('2013-11-06', 'Ole Pedersen','201210066', 'dDB', 7);

You can also do this with select, if you drop the parentheses:

insert into exams(date, censor, idstudents, idcourses, grade)
    select '2013-11-06', 'Ole Pedersen','201210066', 'dDB', 7;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related