Dev Corner

Software Developer’s Notepad

You can use the following SQL to select random record from a PostreSQL table.

SELECT first_name, last_name FROM customer
ORDER BY RANDOM()
LIMIT 1

This SQL can also be used with PostgreSQL:

SELECT * FROM TABLE OFFSET RANDOM() LIMIT 1;

Add A Comment

You must be logged in to post a comment.