Return rows in random order [duplicate]

Is it possible to write SQL query that returns table rows in random order every time the query run?


Solution 1:

SELECT * FROM table
ORDER BY NEWID()

Solution 2:

This is the simplest solution:

SELECT quote FROM quotes ORDER BY RAND() 

Although it is not the most efficient. This one is a better solution.

Solution 3:

The usual method is to use the NEWID() function, which generates a unique GUID. So,

SELECT * FROM dbo.Foo ORDER BY NEWID();