codejump

Queries, Updates & Transactions — Series 2

Preview — 3 of 10 questions

A route creates two rows but a unique-key error occurs on the second insert before commit. What should it do with the transaction?

ARoll back so neither row is committed
BCommit the first row and ignore the intended atomic operation
CReturn 200 without inspecting the error
DRetry both inserts in the same failed session without rollback

A handler wants Heroes ordered by name before applying offset and limit. Which query component supplies the ordering?

A.refresh(Hero.name)
B.order_by(Hero.name)
C.add(Hero.name)
D.delete(Hero.name)

A route queries session.get(Hero, hero_id) and then patches that row. Why use get here?

AIt automatically locks all matching rows
BIt returns every row with that name
CThe path identifies one row by its primary key
DIt commits the update itself

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.