These queries are hard to do with just an ORDER BY and WHERE clause alone. This could be top 1, top 3, top 5, top 10, or top any number. These are also called “top-N queries” because you’re trying to find the top number of records from a result set. Find the top 20 most profitable customers.You can also use the WHERE clause to filter data.īut what if you wanted to only return a certain number of rows? You can use the ORDER BY clause to order data however you like. SELECT queries in SQL allow you to return results from database tables. What is the “SQL Limit” or Row Limiting Feature?
Click on any of these headings to be taken to that place on the page. Learn how to use this SQL limit feature in this article. You can do that in SQL using a “row limiting” feature. Do you need to get the top rows in an SQL query?ĭo you need to perform pagination, or find the top 5 or 10 results from a query?