반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /* DDL (Data Definition Language) : Creat문, Drop문, Alter문, Truncate문 */ /* Create Table */ create table employees2( employee_id number(10), name varchar2(20), salary number(7,2) ); select * from employees2; /* 같은 테이블을 동일하게 만들 때 */ create table employees3 as select * from employees2; select * from employees3; /* Alter - add: 테이블 추가 */ alter table employees2 add( manager_id varchar2(10) ); select * from employees2; /* Alter - modify : 테이블 수정 */ alter table employees2 modify( manager_id varchar2(20) ); /* Alter - drop column : 칼럼 삭제 */ alter table employees2 drop column manager_id; select * from employees2; /* 문자형 데이터 char, varchar, nchar, nvarchar, long 형태 존재 long은 최대 2GB가능 */ /* Drop문 : 테이블 구조를 삭제 */ drop table employees2; select * from employees2; /* Rename */ Rename employees3 to employees2; desc employees3; desc employees2; /* Truncate : 테이블 내의 모든 레코드 삭제 */ truncate table employees2; select * from employees2; | cs |
반응형
'프로그래밍 > SQL' 카테고리의 다른 글
[Oracle SQL] 무결성 제약조건 (0) | 2017.08.12 |
---|---|
[Oracle SQL] INSERT, UPDATE, DELETE, COMMIT, ROLLBACK (0) | 2017.08.10 |
[Oracle SQL] SubQuery 서브쿼리 (0) | 2017.08.10 |
[Oracle SQL] Join (0) | 2017.08.08 |
[Oracle SQL] GROUP BY, HAVING, ROLLUP (0) | 2017.08.08 |