ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 果想随机抽取其中4条记录

果想随机抽取其中4条记录

原创 Linux操作系统 作者:lottery009 时间:2019-03-27 21:48:06 0 删除 编辑

果想随机抽取其中4条记录

create table t as select * from all_objects where rownum <= 5000;
set timing on

select object_name, object_id
from ( select object_name, object_id
from t
where object_name like '%%'
order by dbms_random.random )
where rownum <= 4;


select object_name, object_id
from ( select object_name, object_id
from t sample ( 1 )
where object_name like '%%'
order by dbms_random.random )
where rownum <= 4;


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

下一篇: 搞懂oracle字符集
请登录后发表评论 登录
全部评论

注册时间:2005-10-18

  • 博文量
    34
  • 访问量
    30305