Select Top Six

Question: In my data base there are 1000 records. I want to access only the top six records depending on their salary. How to do this?

Answer:Select all of the records ordered by salary in descending order.

SELECT * FROM mytable ORDER BY salary DESC;

Then just read the first 6 records retrieved.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow