Skip to content
Advertisement

Finding the person with highest salary on mysql sample database

I have this mysql sample database (https://dev.mysql.com/doc/employee/en/sakila-structure.html).

The question is i need to find top10 persons with highest salaries on the database. So far ive tried next queries

and:

This one gave me an error

Somewhy i think i need to include this

But i just cant figure how.

What am i missing there?

Advertisement

Answer

Your first query is basically correct but you need a descending sort:

This puts the biggest values first.

Note that I would recommend uses table aliases for the query:

Table aliases make it easier to both write and read the query.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement