Home › GATE CSE › computerscience › Database Management Systems › In `ORDER BY age ASC, name DESC`, how are rows o…
In `ORDER BY age ASC, name DESC`, how are rows ordered when two students share the same age?
Aby insertion order, oldest insert first
Bthe database picks arbitrarily
Cby name in DESC order (Z to A)
Dby primary key ascending
Answer & Solution
Correct answer: C. by name in DESC order (Z to A)
Multiple sort keys form a hierarchy: the first key dominates, later keys break ties. With two students of the same age, name DESC decides; the student whose name sorts later alphabetically (Z-side) appears first. ORDER BY makes the ordering deterministic instead of leaving it to the engine.
Related questions
The main reasons production DBMSs avoid shadow paging in favour of WAL are that shadow pagWhat is the purpose of a Compensation Log Record (CLR) in ARIES?ARIES recovery is structured as exactlyFuzzy checkpoints differ from naive checkpoints byIn standard log-based recovery, the order of operations isAfter a crash, with checkpointing, the recovery system scans the logA complete log record for a write operation includesPer WAL semantics, a transaction is officially committed at the moment