sql select random sample code example
Example 1: select random sql
SELECT column FROM table
ORDER BY RANDOM()
LIMIT 1
Example 2: select random sample sql
Using a SAMPLE clause, we can select random rows.
SELECT * FROM table_name SAMPLE(10);
Example 3: sql select random procentage from rows
-- for 10% --
SELECT * FROM table_name
ORDER BY random()
LIMIT (SELECT (COUNT(*)*0.01)::INT FROM table_name);