Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
SELECT name FROM mydb ORDER BY score DESC LIMIT 10;

The query above will be returning the first 10 ranks.

How can I change the LIMIT, or maybe is there any other syntax to query the 10th rank through the 20th rank? 

1 Answer

0 votes
by (12.7k points)
edited by

You have to use the following:

SELECT name FROM mydb ORDER BY score DESC LIMIT 10,10;

Check this out! 

The two arguments 10,10 are (Offset, Limit). Hence, the above is going to retrieve rows 11-20.

9,11 Would be needed to take the 10th - 20th rank.

Want to learn more concepts related to SQL? Join SQL Certification course fast!

Related questions

0 votes
1 answer
asked Jul 9, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Jul 26, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 19, 2019 in SQL by Tech4ever (20.3k points)

Browse Categories

...