I tried to create to the table into my database but every time I try it says Connected Successfully. Couldn't create a table.
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near Order( Order_id int(8) AUTO_INCREMENT, Cus_id int(8), Order_date at line 1
Couldn't create table.
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Order(Order_id))' at line 8
I have included the code below.
CREATE TABLE Order(
Order_id int(8) AUTO_INCREMENT,
Cus_id int(8),
Order_date TIMESTAMP,
Primary Key (Order_id),
Foreign Key (Cus_id) References Customer(Cus_id))
CREATE TABLE OrderLine(
Order_id int(8),
P_code int(8),
Quantity float,
Price float,
Constraint PK_Orderline Primary Key (P_code,Order_id),
Foreign Key (P_code) References Product(P_code),
Foreign Key (Order_id) References Order(Order_id))
INT(8)
instead of justINT
? The 8 is junk that's ignored anyway. Also useDECIMAL(x,y)
for prices, don't useFLOAT
for anything financial. It will round and mangle your data in all kinds of unfortunate ways. - tadmanOrder
and(
syntax.MYSQL
assume ittable name
asOrder(
- PHP Ninja