Move «cold» rows into a separate table
src holds two kinds of rows: "hot" (kind = 'hot') and "cold" (kind = 'cold'). Cold rows must be atomically moved into dest — no race window between deleting from one and inserting into the other.
src(id, kind) holds four rows: a pair of hot and a pair of cold. dest(id, kind) has the same structure and is empty. In a single statement, delete all cold rows from src and insert them straight into dest. After the operation src keeps only hot rows, while dest receives the cold ones.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| id | kind |
|---|---|
| 2 | cold |
| 4 | cold |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in