Inserting Values into table with Date Data Type

My table looks like this:

create table order_information (

    donut_order_id smallint,
    order_date date,
    special_handling_notes varchar(255),

    primary key(donut_order_id)

);

My insert statement looks like this:

insert into order_information(donut_order_id, order_date, special_handling_notes), values(1, '2018-01-01', 'do not eat any of them on the way');

My error message looks like this:

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', values(1, '2018-01-01', 'do not eat any of them on the way')' at line 1 0.000 sec

The documentation looks like this:

The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

Documentation is located here

What am I doing wrong?

Upvotes: 0

Views: 66

Answers (1)

Kizivat
Kizivat

Reputation: 173

Don't put comma after into ....

Correct insert: insert into order_information(donut_order_id, order_date, special_handling_notes) values(1, '2018-01-01', 'do not eat any of them on the way');

Upvotes: 2

Related Questions