Reputation: 10203
I would like to sample n rows from a table at random. Alas
SELECT * FROME testtable sample (10 rows);
as the docs suggest gives me:
SQL compilation error: Sampling with sample missing tag for parameter seed.
Tagging on SEED(123)
gives me
SQL compilation error: Sampling with sample wrong number of arguments for parameter seed.
Upvotes: 0
Views: 2438
Reputation: 6279
Seems to work okay for me. Are you sure that's a table you are sampling on and not a view / materialised view or anything?
If you have access to the snowflake_sample_data
database could you try this and see?
select
*
from snowflake_sample_data.tpch_sf1.customer sample (10 rows)
;
Upvotes: 2
Reputation: 194
If I correctly understand, you want to randomly select 10 rows from a table.
The following can help to achieve this result:
select * from testtable
order by RANDOM(123)
limit 10;
Upvotes: 1