Start learning →

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.
Practise this question with Quill — GATE CSE →

Keep practising Database Management Systems

Browse all Database Management Systems questions for GATE CSE, or explore more Computer Science topics.

Start a Database Management Systems lesson →
Related questions