SQL Server
SELECT TOP N * FROM 表名 ORDER BY NEWID()
My SQL
SELECT * FROM 表名 ORDER BY RAND() LIMIT N
Oracle
SELECT * FROM ( SELECT * FROM 表名 ORDER BY DBMS_RANDOM.VALUE )WHERE ROWNUM < = N;