CREATE TABLE
: 데이터 를 저장하는 새로운 테이블을 생성합니다.
CRATE TABLE table_name (
column_name, dat_type expr,
column_name, dat_type expr,
.....
);
CREATE TABLE emp01(
empno NUMBER(4),
ename VARCHAR2(10),
sal NUMBER(7, 2)
);
DESC emp01;
CREATE TABlE emp02
AS
SELECT * FROM emp;
DESC emp02
SELECT * FROM emp02;
CREATE TABLE emp03
AS
SELECT empno, ename FROM emp;
DESC emp03
SELECT * FROM emp03;
CREATE TABLE emp04
AS
SELECT * FROM emp WHERE 1=0;
DESC emp04
SELECT * FROM emp04;
ALTER TABLE emp01
ADD (job VARCHAR2(9));
DESC emp01;
ALTER TABLE emp02
RENAME COLUMN mgr to mgrno;
DESC emp02;
ALTER TABLE emp01
MODIFY(job VARCHAR2(30));
DESC emp01;
ALTER TABLE emp01
DROP COLUMN job;
DESC emp01;
DROP TABLE emp03;
SELECT * FROM recyclebin;
SELECT * FROM emp03;
DROP TABLE emp03 PURGE;
SELECT * FROM recyclebin;
TRUNCATE TABLE emp02;
SELECT * FROM emp02;
RENAME emp02 TO new_emp01;
SELECT * FROM TAB;
CREATE TABLE dept01(
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13)
);
DESC dept01;
SELECT *FROM dept01;
CREATE TABLE empcopy
AS
SELECT empno,ename,sal FROM emp;
DESC empcopy
SELECT * FROM empcopy;
CREATE TABLE dept02
AS
SELECT *FROM dept WHERE 1=0;
DESC dept02
SELECT * FROM dept02;
DROP TABLE dept02;
SELECT * FROM tab;
CREATE TABLE dept03
AS
SELECT *FROM dept WHERE 1=0;
DESC dept03
SELECT * FROM dept03;
ALTER TABLE dept03
ADD(dmgr VARCHAR2(18));
DESC dept03;
ALTER TABLE dept03
DROP COLUMN dmgr;
DESC dept03;