Problem Description

You are inserting parent and child rows in one transaction. Write a safe sequence so the FK does not fail when you insert child first.

Input Format

SQL script

Output Format

SQL statements

Sample Test Case

Input:
Parent(id), Child(id, parent_id)
Output:
Successful insert

Constraints

Assume FK exists; insert order matters

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next