반응형

출처: http://hyeonstorage.tistory.com/292

http://stackoverflow.com/questions/212939/how-do-i-modify-a-mysql-column-to-allow-null


1. 컬럼 추가

alter table 테이블명 add 추가컬럼명 데이터유형;


2. 컬럼 삭제

alter table 테이블명 drop column 삭제컬럼명;


3. 컬럼 수정

alter table 테이블명 modify( 컬럼명1 데이터유형 [default 식] [not null],

컬럼명2 데이터유형 [default 식] [not null]);


4. 컬럼명 수정

rename column 이전컬럼명 to 새컬럼명;


5. 제약조건 추가

alter table 테이블명 add constraint 제약조건명 제약조건 (컬럼명);


6. 제약조건 삭제

alter table 테이블명 drop constraint 제약조건명;


반응형
Posted by 애콜라이트
l

free counters