How do i select bottom n rows in snowflake

Is there a way to choose bottom n rows instead of top n rows in snowflake ?

Gattu-Bhavani

posted on 12 Aug 20

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds




nVector12-Aug-20

(Edited the question for more clarity)

The top 100 * or the limit clause fetches 100 random rows from the table, irrespective of where they are located in the table.

You can do this instead.

Select * from table name

Order by col1 desc

Limit 100;

Here the col1 is your key column which you want to sort the data and fetch the bottom n rows