mysql 시퀀스 컬럼 생성 및 초기화

생성예제

CREATE TABLE `board` (
`seq` int(11) NOT NULL AUTO_INCREMENT,
`writer` varchar(20) NOT NULL,
`title` varchar(100) NOT NULL,
`content` mediumtext,
`pwd` varchar(20) NOT NULL,
`hit` decimal(5,0) NOT NULL,
`groups` decimal(10,0) NOT NULL,
`step` decimal(3,0) NOT NULL,
`level` decimal(3,0) NOT NULL,
`bname` varchar(10) NOT NULL,
`regdate` datetime NOT NULL,
PRIMARY KEY (`seq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

초기화 예제

alter table board auto_increment=1;

참고사이트 : http://roqkffhwk.tistory.com/136

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s