Complex trigger with transaction-safe stock check

SQL Hard 0 views
Back to Questions

Problem Description

Before inserting OrderItems, ensure Inventory has enough qty for that product. If stock is not enough, raise an error to stop the insert.

Input Format

SQL DDL

Output Format

Trigger created

Sample Test Case

Input:
OrderItems, Inventory
Output:
Trigger created

Constraints

MySQL-style SELECT ... INTO variable

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next