Question of the Day,. .. Can anyone get this right?

  • Given a table (STUDENT) that contains two fields:

    NameScore
    Smith36
    Jones90
    ......

    Write a single SELECT query using only standard SQL (i.e. don't use Top N or another platform specific predicates) that returns the name and score for the top 5 students.

  • SELECT a.stname, a.score FROM student a WHERE (SELECT COUNT (DISTINCT (b.score)) FROM student b WHERE a.score<=b.score) BETWEEN 1 AND 5

    ORDER BY a.score DESC

    I think this is the required solution.

     

    Regards

    Padmaja

     

     

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply