Full width home advertisement

Post Page Advertisement [Top]

For MySQL:

SELECT * FROM table_name ORDER BY RAND() LIMIT 1

You can also use below code to make query faster:

SELECT * FROM table_name WHERE RAND() > 0.9 ORDER BY RAND()


For PostgreSQL:


SELECT * FROM table_name ORDER BY RANDOM() LIMIT 1


For Orace:

SELECT * FROM ( SELECT * FROM table_name ORDER BY dbms_random.value )
WHERE rownum = 1


For Microsoft SQL Server:

SELECT TOP 1 column FROM table_name ORDER BY NEWID()

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib