auto increment 속성은 primary key인 컬럼에 추가가 가능하다.
예를 들어
mysql> create table EVALUATION(
-> evaluationId varchar(20),
-> userId varchar(20),
-> lectureName varchar(30),
-> );
가 있다고 하자.
여기서 evaluationId에 primary key 랑 auto increment속성을 추가하고 싶으면?
ALTER TABLE document MODIFY COLUMN document_id INT auto_increment
위와 같은 명령을 수행한다.
여기에서는
mysql> alter table evaluation modify evaluationId int primary key;
mysql> alter table evaluation modify evaluationId int auto_increment;
와 같은 명령을 수행해주면 되겠다.
그 외 auto_incrememt 초기화 라던지 다른것은
'개발 > Web Programming' 카테고리의 다른 글
'const' can only be used in a .ts file. 문제 (0) | 2019.04.03 |
---|---|
yarn add 시 Unexpected end of JSON input 문제 해결법 (0) | 2019.04.03 |
JSP request getAttribute()와 getParameter()의 차이점 (0) | 2019.03.21 |
JSP 스크립트 요소 (0) | 2019.03.19 |
Boostrap 자동완성 팁 (0) | 2019.03.17 |