Withdata Software

How to select N random records from a SQLite table

If you want to select N random records from a SQLite 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 SQLite tools you can try: https://www.withdata.com/sqlite/

Convert your data online, free

Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.