--删除重复值-保留重复值最大的编号
delete from emp where rowid in(
select rowid from emp where rowid not in(
select max(rowid) rd from emp group by empname)
)
--去重复查询
select distinct empname from emp
--查询重复值以外的所有信息
select * from emp where empname in(select empname from emp group by empname having count(empname)=1)
--三层嵌套实现分页
select * from
(
select emp.*,rownum rn
from emp
where rownum<=(3*3)
) where rn>=(3-1)*3+1
--旧表备份新表
create table emp1 as select * from emp
--并集,查询两张表不重复的值
select * from emp
union
select * from emp1
--并集,查询两张表所有 及 重复值
select * from emp
union all
select * from emp1
--交集查询两张表共同存在的值
select * from emp
INTERSECT
select * from emp1
--减集 emp1 - emp 剩余的信息
select * from emp1
MINUS
select * from emp
--查看回收站的表
SELECT * FROM RECYCLEBIN;
--根据查询的信息还原表(恢复表时,索引和表数据等相关信息都会自动恢复)
flashback table '需要恢复的表名(original_name)' to before drop;