SQL Practice Logo

SQLPractice Online

Level 5 - SeniorQuery-Based Questions

Create Foreign Key with Action Rules

Interviewer prompt: Build order_items table that references orders and products. If order is deleted, items should delete. If product is deleted, reject deletion. Write DDL.

Schema Context

orders(order_id), products(product_id)