各个数据库获取随机列的语法

原文链接:http://www.javaarch.net/jiagoushi/703.htm

各个数据库获取随机列的语法

MySQL

	SELECT column FROM table ORDER BY RAND() LIMIT 10

Oracle

	SELECT column FROM( SELECT column FROM table ORDER BY dbms_random.value ) WHERE rownum <= 10
	
PostgreSQL

	SELECT column FROM table ORDER BY RANDOM() LIMIT 10
	
SQL Server

	SELECT TOP 10 column FROM table ORDER BY NEWID()


posted @ 2013-06-02 17:35  zhwj184  阅读(146)  评论(0编辑  收藏  举报