Problem Description

Decrease Inventory.qty by requested amount only if enough stock. Make it atomic in one statement and run inside a transaction.

Input Format

SQL script

Output Format

Statements

Sample Test Case

Input:
Inventory(product_id, qty)
Output:
Safe decrement

Constraints

Use conditional update

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next