SQL ORDER BY RANDOM
If you want the resulting record to be ordered randomly, you should use the following codes according to several databases.
Here a question occurs that what is the need of fetching a random record or a row from a database?
Sometimes you may want to display random information like articles, links, pages etc. to your user.
If you want to fetch random rows from any of the databases you have to use some queries which are altered according to the databases.
Select a random row with MySQL:
If you want to return a random row with MY SQL, Use the following code:
Select a random row with Postgre SQL:
Select a random row with SQL Server:
Select a random row with oracle:
Select a random row with IBM DB2: