copying a column

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm learning how to copy columns and I'm having a little trouble.
The column that I'm trying to copy is from the same database. Correct
me if I am wrong, but I think you have to create the column in the
database first? Here is the command that I'm using, but its not
working, obviously.

mysql> alter table bugs add column test mediumint(9) NOT NULL
ERROR 1075 (42000): Incorrect table definition; there can be only one
auto column and it must be defined as a key

Here is the table that has the column that I'm trying to copy from:

mysql> describe bugs \G
*************************** 1. row ***************************
  Field: bug_id
   Type: mediumint(9)
    Key: PRI
Default: NULL
  Extra: auto_increment

Can somebody give me a clue. Also, I'm looking for detailed
documentation on primary keys, if somebody has such a link, please send
it to me, thanks in advance.


Re: copying a column

On 14/06/2005, usaims wrote:

Quoted text here. Click to load it

You don't create columns in a database, but in a table (which lives in
a database)

Quoted text here. Click to load it

You already have an auto_increment column in your table and you only
can have one: so you cannot add another

Quoted text here. Click to load it

Type 'primary key' in a google search box.


Site Timeline