3 ms·
For the newbies: quick way I'll get a sample of rows (without weights) in Redshift: `SELECT * FROM sales ORDER BY RANDOM() LIMIT 10;`
by indoordin0saur 2y ago
For the newbies: quick way I'll get a sample of rows (without weights) in Redshift:
`SELECT *
FROM sales
ORDER BY RANDOM()
LIMIT 10;`
- peterm4 2y agoBeen working with sqlite and Typescript, needing random rows sampled reproducibly with a seed. Found this handy little trick [0]. Not the cleanest, but it works! `SELECT * FROM sales ORDER BY substr(${seedValue} * sales.id, length(sales.id) + 2) LIMIT 10;` [0] https://stackoverflow.com/questions/24256258/order-by-random-with-seed-in-sqlite https://stackoverflow.com/questions/24256258/order-by-random...