ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle、my sql、sql随机查询语句

oracle、my sql、sql随机查询语句

原创 Linux操作系统 作者:iSQlServer 时间:2010-09-20 13:27:04 0 删除 编辑

1. Oracle,随机查询20条

select * from( select * from 表名 order by dbms_random.value)
where rownum <= 20;

 

2.SQL Server,随机查询20条

select top 20   * from 表名order by newid()

 

3.My SQL:,随机查询20条

select * from 表名 order by rand() limit 20

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16436858/viewspace-674469/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-10-17

  • 博文量
    1319
  • 访问量
    2342899