Reputation: 22143
I tried to create a brand new table with codes:
MySQL [distributor]> create table order
-> (
-> order_num integer not null,
-> order_date datetime not null,
-> cust_id chat(10) not null
-> );
It generates errors:
ERROR 1064 (42000): 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 'order
(
order_num integer not null,
order_date datetime not null,
cust_id chat(' at line 1
I have checked multiple times to ensure there no problems in my codes since SQL is case-insensitive.
What's the bug with my code?
Upvotes: 0
Views: 90
Reputation: 147286
There are two issues with your query: Firstly, order
is a MySQL reserved word. Secondly, you have chat
which should be char
. Try this instead (renaming table to orders
):
CREATE TABLE orders
(
order_num integer not null,
order_date datetime not null,
cust_id char(10)
);
Upvotes: 1
Reputation: 9
order it's a reserved word and put char instead of chat. You can name the table orders
Upvotes: 1