기본
컬럼 추가
ALTER TABLE tbl_name ADD COLUMN new_col_name COLUMN_TYPE;
ALTER TABLE tbl_name ADD COLUMN new_col_name COLUMN_TYPE DEFAULT 'ABC';
ALTER TABLE tbl_name ADD COLUMN new_col_name COLUMN_TYPE DEFAULT 'ABC' NOT NULL;
컬럼 제거
ALTER TABLE tbl_name DROP col_name;
이름 변경
ALTER TABLE tbl_name RENAME COLUMN col_name TO new_name;
코멘트 설정
COMMENT ON COLUMN tbl_name.col_name IS '컬럼 코멘트';
코멘트 제거
COMMENT ON COLUMN tbl_name.col_name IS NULL;
타입
타입 변경
ALTER TABLE tbl_name ALTER COLUMN col_name TYPE COLUMN_TYPE;
타입 변경 + 일괄 값 변경
ALTER TABLE tbl_name ALTER COLUMN col_name TYPE COLUMN_TYPE USING col_name::COLUMN_TYPE;
제약
NOT NULL 제약 추가