Hello,
It's probably a very simple question, excuse a newbie :)
In a simple database for email addresses:
First Name :: Last Name :: email
I want to add a column at the first and call it 'num' that is auto incremented
I do the following
ALTER TABLE emails ADD num INT AUTO_INCREMENT FIRST, ADD UNIQUE KEY(num);
I'm adding the UNIQUE KEY because Mysql refuses to add AUTO_INCREMENT without being defined as a key.
It works great but if I delete one of the records the 'num' column isn't updated, example.
1 f l
f_l@email.dom
2 ab cd
ad@bd.dom
3 ef gh
eh@fg.com
When 2 ab cd
ad@bd.dom is deleted the DB looks like
1 f l
f_l@email.dom
3 ef gh
eh@fg.com
I want it to be
1 f l
f_l@email.dom
2 ef gh
eh@fg.com
Is it possible without deleting the 'num' column and adding it again everytime I delete a row?
Many thanks.