How to select N random records from a PostgreSQL table

by

If you want to select N random records from a PostgreSQL table, you need to change the clause as follows:

select * from tableName order by random() limit N

For example, to select 5 random customers in the customers table, you use the following query:

select * from customers order by random() limit 5

Some PostgreSQL tools you can try: https://www.withdata.com/postgresql/