database.sarang.net
UserID
Passwd
Database
DBMS
ㆍMySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
MySQL Q&A 29777 게시물 읽기
No. 29777
table_option의 auto_increment
작성자
김지숙(koyoro)
작성일
2010-08-30 18:14
조회수
8,338

table을 생성할때 아래와 같이 table_option을 넣는데요..

CREATE TABLE table_name(

.

) ENGINE=InnoDB AUTO_INCREMENT=1;

 

table_option중에 auto_increment는 어떤 목적으로 사용하는건가요?

field의 auto_increment는 알고 있는데 table option으로 넣는건 처음봐서요...

create table syntax 메뉴얼을 찾아봐도 자세한 설명은 없네요...(훑어 본거라 제가 놓쳤을지도 모르겠습니다;)

 

table_option의 auto_increment에 대해서 아시는분,

또는 메뉴얼에서 table_option에 대해 자세하게 설명한 부분이 어디 있는지 아시는분

답변 부탁드립니다.

이 글에 대한 댓글이 총 2건 있습니다.

http://dev.mysql.com/doc/refman/5.1/en/create-table.html

위 페이지의 table_option: 항목에 AUTO_INCREMENT에 대한 설명이 있습니다. (아래에 일부 발췌)

An integer or floating-point column can have the additional attribute AUTO_INCREMENT. When you insert a value ofNULL (recommended) or 0 into an indexed AUTO_INCREMENT column, the column is set to the next sequence value. Typically this is value+1, where value is the largest value for the column currently in the table.AUTO_INCREMENT sequences begin with 1.

 

 

해당 테이블의 AUTO_INCREMENT 값을 지정할 때 쓰입니다.

예를 들어, AUTO_INCREMENT 속성을 가지는 컬럼이 1000부터 시작되기를 원한다면, 1000 으로 적으시면 되겠습니다.

박현우(lqez)님이 2010-08-30 18:43에 작성한 댓글입니다.

답변 감사합니다. ^^

column의 auto_increment의 시작 값이였군요;;

 

  • AUTO_INCREMENT

    The initial AUTO_INCREMENT value for the table. In MySQL 5.1, this works for MyISAM, MEMORY, and InnoDB tables. It also works for ARCHIVE tables as of MySQL 5.1.6. To set the first auto-increment value for engines that do not support the AUTO_INCREMENT table option, insert a “dummy” row with a value one less than the desired value after creating the table, and then delete the dummy row.

    For engines that support the AUTO_INCREMENT table option in CREATE TABLE statements, you can also use ALTER TABLE tbl_name AUTO_INCREMENT = N to reset the AUTO_INCREMENT value. The value cannot be set lower than the maximum value currently in the column.

 

김지숙(koyoro)님이 2010-08-30 22:44에 작성한 댓글입니다.
이 댓글은 2010-08-30 22:49에 마지막으로 수정되었습니다.
[Top]
No.
제목
작성자
작성일
조회
29781ndb 테이블 Lock 문제 [1]
이철수
2010-09-02
7725
29780jeus.jdbc.driver.blackbox.BlackboxConnection.setAutoCommit 에러..
질문이
2010-09-01
7851
29778replication설정이 안됩니다. 꼭 좀 봐주세요?? [4]
조근호
2010-08-30
7587
29777table_option의 auto_increment [2]
김지숙
2010-08-30
8338
29776MySQL Sleep이 너무 많은 현상 [2]
디비악마
2010-08-30
9247
29775테이블 값 참조 질문 드립니다. [1]
정현철
2010-08-30
7471
29774mysql root 계정이 안생깁니다. [1]
박재헌
2010-08-30
6922
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.033초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다