One of the most handy functions in programming is the ability to display random records. Luckily in SQL this is very easy.
This is usefull when you want to display random products, random images, etc..
So in your query you just add “ORDER BY RAND()”
So the Query will look like:

SELECT * FROM mytable ORDER BY RAND() LIMIT 10

easy 🙂

Janes Oosthuizen

Author Janes Oosthuizen

Programmer and Tech Junky from Cape Town, South-Africa. I have been programming for more than 15 years in various languages including ( CSS, HTML, javascript, PHP, MySQL, Wordpress and many other ).

More posts by Janes Oosthuizen

Leave a Reply