Amazon Athena - ANSI SQL - use LIMIT to only select first few rows
When developing or testing SQL queries, it can be useful to limit the number of rows being return, both to save time and avoid Amazon costs.
Like the 'TOP' keyword of Microsoft T-SQL, there is a LIMIT keyword available in the ANSI SQL used with Athena.
Example:
SELECT * from myDatabase.MyTable -- will retrieve ALL data from the table, possibly increasing your bill from Amazon!
SELECT * from myDatabase.MyTable LIMIT 50 -- will only retrieve the first 50 rows
Comments
Post a Comment