백업테이블 생성

- full backup

create table 테이블명 as select * from 원본테이블명;

 

- partial backup

create table 테이블명 as select 필드명,.. from 원본테이블명 where 조건식;
//백업테이블의 가상필드에는 별칭을 지정해야한다.
create table b_emp as select deptno, count(*) e_count, avg(sal) e_avg,
sum(sal) e_sum, min(sal) e_min, max(sal) e_max
from emp group by deptno;

    DEPTNO    E_COUNT      E_AVG      E_SUM      E_MIN      E_MAX
---------- ---------- ---------- ---------- ---------- ----------
        30          6 1566.66667       9400        950       2850
        20          5       2175      10875        800       3000
        10          3 2916.66667       8750       1300       5000

 

- copy schema

create table 테이블명 as select 필드명,.. from 원본테이블명 where 1=0;

 

 

+ Recent posts