Skip
Arish's avatar

264. Practice - FOREIGN KEY 2


Exercise: Multiple FKs

Create table with two foreign keys.

Solution

sql
1CREATE TABLE reviews (
2  id INTEGER PRIMARY KEY,
3  product_id INTEGER,
4  user_id INTEGER,
5  rating INTEGER,
6  FOREIGN KEY (product_id) REFERENCES products(id),
7  FOREIGN KEY (user_id) REFERENCES users(id)
8);