MySql
从table1中随机读取10记录,放到刚创建的表table2中(表结构和table1一样)
create table table2 as select * from table1 order by rand() limit 10
插入
insert into table2
( select * from table1 order by rand() limit 10);
oracle
从table1中随机读取1000记录,放到刚创建的表table2中(表结构和table1一样)
create table table2 as select * from (select * from table1 order by dbms_random.value) where rownum <= 1000 ;
插入
insert into table2 select * from (select * from table1 order by dbms_random.value) where rownum <= 1000 ;