-3

Im using MYSQL 8.In the terminal it says to check syntax. Here is the chart.

create table order( id INTEGER AUTO_INCREMENT, customer_id INTEGER, subtotal DECimal, tax DECimal, total DEC, purchase_at DATE, updated_at DATE, PRIMARY KEY (id), FOREIGN KEY (customer_id) REFERENCES customer (id), );

I was trying to create a table and expecting it to run without error.

Courtney
  • 1
  • 1

1 Answers1

1

order is a keyword, so I changed it to orders

Removed a trailing comma near the end of the line.

create table orders(
id INTEGER AUTO_INCREMENT, 
customer_id INTEGER, 
subtotal DECimal, 
tax DECimal, 
total DEC, 
purchase_at DATE, 
updated_at DATE, 
PRIMARY KEY (id), 
FOREIGN KEY (customer_id)
REFERENCES customer (id));