MS SqlServer : select top N * from Table1 order by NewId() MySql: SELECT * FROM tableName ORDER BY rand()