cant't create table in sql
I wrote the exact same code as the 'creating a table' as follows using mysql 8.0:
create table sales
(
purchase_number int not null primary key auto_increment,
date_of_purchase date not null,
customer_id int,
item_code int varchar(10) not null
);
However, error 1064 keeps popping up like this:

May I know what's going wrong?
4 answers ( 0 marked as helpful)
need to add database name in front of table name in MySql 8.0
Hi Longyin!
Thanks for reaching out.
Please remove the statement terminator (i.e. the semi-colon ;
) after CREATE TABLE sales
and retry.
Hope this helps.
Best,
Martin
Hi
I had the same problem, you have to specify the name of the database in this way:
put "use [name of the database]" before the first sentence.
Hi Mehraveh!
Thanks for reaching out.
Thanks for sharing this piece of information with the Community!
The statement terminator (i.e. the semi-colon ;
) after CREATE TABLE sales
should be removed.
Hope this helps.
Best,
Tsvetelin