SQL for collecting random record from a table
Here we have to use rand() function and along with it we will use limit query to restrict our result to one record. Random function is used along with order by clause to generate random records. This will work well in other database also. Here is the query. We have added on where clause also.
To get 10 random records from the same table.
Let us learn how to randomly update records of a table in Part II
This article is written by plus2net.com team. https://www.plus2net.com
▼ More on getting records from table with different combinations of commands