MySQL: AUTO_INCREMENT with PRIMARY KEY

248 Views Asked by At

I've done a little research on this in the past hour, and I could use some help understanding some things.

Why doesn't this work? Got the basis for it from link

ALTER TABLE customers
MODIFY COLUMN customer_id INT AUTO_INCREMENT PRIMARY KEY;

When I attempt to run it, I receive the error: Multiple primary key defined.

It works when I take out PRIMARY KEY, but is it still doing what I need it to do? (which is increment the customer_id, which is a PK, by 1.)

The customer_id is a primary key, does marking it as a primary key make it think that there are two?

Another question, when you use AUTO_INCREMENT without declaring how many it increments by, what is the default value to increment, 1?

0

There are 0 best solutions below