I have a table called STUDENT
+-----------+-----------+-----------+---------------+ | StudentID | FirstName | LastName | EnrollmenDate | +-----------+-----------+-----------+---------------+ | 1 | x | x | x | | 2 | x | x | x | | 3 | x | x | x | +-----------+-----------+-----------+---------------+ Write a query that pulls the student who registered the last?
a) select top 1 * from STUDENTorder by EnrollmentDate Desc
or
b) select * from STUDENT where EnrollmentDate = (select Max(EnrollmentDate) from STUDENT)
I tend to ask this question in interview. One candidate answered b) I was expecting a). Which one is better query?