Table Result(name, marks) has rows (‘Ali’,80), (‘Bina’,90), (‘Chand’,80), (‘Dua’,70). SELECT name FROM Result ORDER BY marks DESC, name ASC LIMIT 2; What is returned?
Correct answer A. Bina, Ali
Explanation
Rows are sorted by marks from highest to lowest, and the second key, name ascending, breaks ties. Bina (90) comes first. Ali and Chand both have 80, and alphabetically Ali comes before Chand, so Ali is second. LIMIT 2 keeps those two rows. Without the tie-breaker the order of Ali and Chand would not be guaranteed.
Answer checked How we write and check questions
Discussion