테이블에 데이터를 넣을때 duplicate 오류가 나는 경우가 있다. 그때 데이터저장을 위해 primary key 를 변경해야할 떄가 있다.
그럴때는 아래의 순서를 따라가보자
1. primary key 삭제
alter table 테이블명 drop primary key;
-> 만약 오류가 날때 (Incorrect table definition, there can be only one auto column and it must be defined as a key)
-> increment auto 를 제거 먼저 필요
2. primary ket 재 추가
alter table 테이블명 add primary key(컬럼명, 컬럼명);
댓글
댓글 쓰기