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之间随机数,查询结果随机排序是它的一种用法。
select id from test where rownum<=(select count(1)/10 from test));
按行号来删除
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之间随机数,查询结果随机排序是它的一种用法。