CREATE Table orders(order_id INT PRIMARY KEY NOT NULL,
customer_id INT,
amount INT,
address_id varchar(50),
order_date DATE,
product_id INT,
quantity INT,
FOREIGN KEY(customer_id) REFERENCES customers(customer_id),
FOREIGN KEY(address_id) REFERENCES address(address_id),
FOREIGN KEY product(product_id) REFERENCES product(product_id));
CodePudding user response:
Why did you change the last foreign key syntax?
SQL> CREATE TABLE orders
2 (
3 order_id INT PRIMARY KEY NOT NULL,
4 customer_id INT,
5 amount INT,
6 address_id VARCHAR2 (50),
7 order_date DATE,
8 product_id INT,
9 quantity INT,
10 FOREIGN KEY (customer_id) REFERENCES customers (customer_id),
11 FOREIGN KEY (address_id) REFERENCES address (address_id),
12 FOREIGN KEY (product_id) REFERENCES product (product_id)
13 );
Table created.
SQL>