Exercise: Create FK
Create orders referencing customers.
Solution
sql
1CREATE TABLE orders (
2 id INTEGER PRIMARY KEY,
3 customer_id INTEGER NOT NULL,
4 FOREIGN KEY (customer_id) REFERENCES customers(id)
5);
Create orders referencing customers.
1CREATE TABLE orders (
2 id INTEGER PRIMARY KEY,
3 customer_id INTEGER NOT NULL,
4 FOREIGN KEY (customer_id) REFERENCES customers(id)
5);