On Mon, Jan 25, 2010 at 10:08 PM, Yong Lee yong@gogoants.com wrote:
yah, mysql only allows one auto increment field n that's used as the
primary key in tables. I don't think it has to be the primary key as
long as it is a unique key i think that's okay.
so u should be able to do :
@lists.mysql.com
Subject: auto_increment without primary key in innodb?
In innodb, is it possible to have an auto_increment field without
making it a (part of a) primary key? Why is this a requirement? I'm
getting the following error. Thanks in advance.
ERROR 1075 (42000): Incorrect table
In innodb, is it possible to have an auto_increment field without
making it a (part of a) primary key? Why is this a requirement? I'm
getting the following error. Thanks in advance.
ERROR 1075 (42000): Incorrect table definition; there can be only one
auto column and it must be defined as a key
Zhang yanghates...@gmail.com
Sent: Monday, January 25, 2010 10:21am
To: mysql@lists.mysql.com
Subject: auto_increment without primary key in innodb?
In innodb, is it possible to have an auto_increment field without
making it a (part of a) primary key? Why is this a requirement? I'm
getting
Message-
From: Yang Zhang yanghates...@gmail.com
Sent: Monday, January 25, 2010 10:21am
To: mysql@lists.mysql.com
Subject: auto_increment without primary key in innodb?
In innodb, is it possible to have an auto_increment field without
making it a (part of a) primary key? Why
2010/1/25 Yang Zhang yanghates...@gmail.com:
Right, I saw the docs. I'm fine with creating an index on it, but the
only way I've successfully created a table with auto_increment is by
making it a primary key. And I still don't understand why this
requirement is there in the first place.
...@gmail.com
Sent: Monday, January 25, 2010 10:21am
To: mysql@lists.mysql.com
Subject: auto_increment without primary key in innodb?
In innodb, is it possible to have an auto_increment field without
making it a (part of a) primary key? Why is this a requirement? I'm
getting the following error
yah, mysql only allows one auto increment field n that's used as the
primary key in tables. I don't think it has to be the primary key as
long as it is a unique key i think that's okay.
so u should be able to do : create table (myid int unsigned not null
auto_increment., unique key (myid));