google-big-queryHow do I limit the results of a query in Google Big Query?
To limit the results of a query in Google Big Query, you can use the LIMIT clause. This clause takes an integer as the argument, which is the maximum number of rows that will be returned by the query.
For example, the following query will return only the first 10 rows of the bigquery-public-data.usa_names.usa_1910_2013 table:
SELECT *
FROM `bigquery-public-data.usa_names.usa_1910_2013`
LIMIT 10
The output of this query will be:
+--------+-------+------+-------+
| name | state | sex | count |
+--------+-------+------+-------+
| Mary | CA | F | 619 |
| Helen | CA | F | 531 |
| Dorothy| CA | F | 476 |
| Margaret| CA | F | 467 |
| Ruth | CA | F | 415 |
| Anna | CA | F | 394 |
| Elizabeth| CA | F | 394 |
| Frances| CA | F | 340 |
| Marie | CA | F | 327 |
| Mildred| CA | F | 305 |
+--------+-------+------+-------+
The LIMIT clause consists of the following parts:
LIMIT: This is the keyword that tells BigQuery to limit the number of rows returned.10: This is the argument that tells BigQuery to return a maximum of 10 rows.
Helpful links
More of Google Big Query
- How can I export data from Google Big Query to an XLSX file?
- ¿Cuáles son las ventajas y desventajas de usar Google BigQuery?
- How can I use Google BigQuery to access Wikipedia data?
- How can I use Google BigQuery to retrieve data from a specific year?
- How can I use Google BigQuery on a Windows system?
- How can I use Google Big Query to integrate with Zephyr?
- How do I use Google Big Query to zip files?
- How can I use the CASE WHEN statement in Google Big Query?
- How do I use the YEAR function in Google BigQuery?
- How can I use Google BigQuery to wait for a query to complete?
See more codes...