์•„๋ž˜ ์˜ˆ์ œ๋Š” JMNote.com์˜ ์œ„ํ‚คํŽ˜์ด์ง€์—์„œ ๋ณต์‚ฌํ•ด์˜จ ๊ฒƒ์ž„์„ ๋ฐํž™๋‹ˆ๋‹ค.

( ์›๋ณธ ์ฃผ์†Œ - 

http://jmnote.com/wiki/%EC%98%A4%EB%9D%BC%ED%81%B4_%EC%BB%AC%EB%9F%BC%EB%AA%85_%EC%88%9C%EC%84%9C_%EB%B3%80%EA%B2%BD

์‹ค์Šต ํ…Œ์ด๋ธ” ์ƒ์„ฑ

CREATE TABLE employee (
emp_no NUMBER PRIMARY KEY,
dept VARCHAR2 (16),
name VARCHAR2 (32)
);
INSERT INTO employee VALUES (130001, '์ธ์‚ฌ๋ถ€', 'ํ™๊ธธ๋™');
INSERT INTO employee VALUES (130002, '์˜์—…๋ถ€', '์ž„๊บฝ์ •');
INSERT INTO employee VALUES (130003, '์ƒ์‚ฐ๋ถ€', '์žฅ๊ธธ์‚ฐ');

๋ณ€๊ฒฝ ์ „

SELECT * FROM employee;
EMP_NO  DEPT    NAME
130001  ์ธ์‚ฌ๋ถ€       ํ™๊ธธ๋™
130002  ์˜์—…๋ถ€       ์ž„๊บฝ์ •
130003  ์ƒ์‚ฐ๋ถ€       ์žฅ๊ธธ์‚ฐ

๋ณ€๊ฒฝ

  • ์žฌ๋ฐฐ์—ด๋œ ์‚ฌ๋ณธ ์ƒ์„ฑ โ†’ ์‚ฌ๋ณธ์„ ์›๋ณธ์œผ๋กœ ๋Œ€์ฒด
CREATE TABLE temp AS SELECT emp_no, name, dept FROM employee;
DROP TABLE employee;
RENAME temp TO employee;

๋ณ€๊ฒฝ ํ›„

SELECT * FROM employee;
EMP_NO  NAME    DEPT
130001  ํ™๊ธธ๋™       ์ธ์‚ฌ๋ถ€
130002  ์ž„๊บฝ์ •       ์˜์—…๋ถ€
130003  ์žฅ๊ธธ์‚ฐ       ์ƒ์‚ฐ๋ถ€