0

I get over 1 million results from this query. How do I limit it to just the first 10 that I can test with?

Select id, first_name, last_name
from customers
Where country = 'US'
Zeic123
  • 43
  • 5
  • 2
    `fetch first 10 rows only`? –  Nov 06 '19 at 17:27
  • This depends on which specific SQL DBMS product you are using. For example in SQL Server you could use `TOP`. In MySQL the equivalent is `LIMIT`. Check your vendor's documentation for the correct thing to use, and for the exact syntax. You can also discover this kind of thing trivially by spending a few seconds using a search engine...what research have you done? We like answering interesting questions here, but we're less keen on just repeating information which is already readily available in many places. – ADyson Nov 06 '19 at 17:33
  • 1
    Possible duplicate of [How to limit the results on a SQL query](https://stackoverflow.com/questions/3128043/how-to-limit-the-results-on-a-sql-query) – Gen Wan Nov 06 '19 at 17:35

1 Answers1

1

Sure! T-SQL

Select TOP 10 id, first_name, last_name

from customers Where country = 'US'

For anything ANSI Compliant see this question which has a similar aim: ANSI SQL version of SELECT TOP 1

JR Kincaid
  • 823
  • 1
  • 7
  • 18