SQL
Publish both sides of a stock transfer
Twelve seals are requested from a store holding ten
A transfer changes two store balances. Reject an impossible transfer without publishing only half of its changes.
BOTIE
The inputs we are comparing
Current store balances
Same in both cases
[
{
"id": "north",
"units": 10
},
{
"id": "south",
"units": 2
}
]Proposed changes by store
Transfer three seals
{
"north": -3,
"south": 3
}The source cannot supply twelve
{
"north": -12,
"south": 12
}Result for transfer three seals
[
{
"id": "north",
"units": 7
},
{
"id": "south",
"units": 5
}
]The transfer uses every remaining source part
This check uses the pieces from “Choose one complete inventory state”.
BOTIE
- Current store balances
[ { "id": "west", "units": 4 }, { "id": "east", "units": 1 } ]- Proposed changes by store
{ "west": -4, "east": 4 }
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
Which effects would a SQL rollback fail to undo if the program had already sent a delivery notification?
A database transaction has a boundary. Effects outside it need their own recovery design.
This is an atomic-choice teaching model. It does not simulate disk persistence, locks or the database transaction log.
Work through the SQL challenges →