日期:2014-05-17  浏览次数:20762 次

求一语句:oracle 删除表中其中一部分数据,仅保留原来1/10的数据,怎么删除现有的记录?
oracle 删除表中其中一部分数据,仅保留原来1/10的数据,怎么删除现有的记录?
随机删除

------解决方案--------------------
delete from test where id not in(
select id from test where rownum<=(select count(1)/10 from test));
按行号来删除
------解决方案--------------------
看不懂
------解决方案--------------------
探讨

delete from test where id not in(
select id from test where rownum<=(select count(1)/10 from test));
按行号来删除

------解决方案--------------------
delete from test where id not in(
select t.id
from (
select * from test order by dbms_random.value
) t
where rownum<=(select count(1)/10 from test)
);
dbms_random.value :该函数用来产生一个介于0和1之间随机数,查询结果随机排序是它的一种用法。