Home >Database >Mysql Tutorial >各个数据库获取随机列的语法_MySQL

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

WBOY
WBOYOriginal
2016-06-01 13:34:08931browse

bitsCN.com

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

 

[html] 

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

  

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

      

PostgreSQL  

  

    SELECT column FROM table ORDER BY RANDOM() LIMIT 10  

      

SQL Server  

  

    SELECT TOP 10 column FROM table ORDER BY NEWID()  

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn