18

How to Select Random Records in MySQL?

 4 years ago
source link: https://www.codexworld.com/how-to/select-random-records-in-mysql/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Home  »  How To Guides  »  MySQL   »   How to Select Random Records in MySQL?

How to Select Random Records in MySQL?


MySQL RAND() function provides an easy way to select random rows from the table. You can get random records from the database using a single SQL query in MySQL. If you want to list the unique data on each page load, the random records feature is very useful.

Use the following SQL to select random records from a table in the MySQL database.

SELECT column FROM table
ORDER BY RAND()
LIMIT 10

Leave a reply

Cancel

Comment*

Your Name*

Your Email*

Your Website


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK