AUTO INCREMENT

Since the MySQL Query Browser on my Mac refused to let me set a field as auto increment through the GUI, here's how you can using SQL change an existing column to use auto_increment:

SQL:
  1. ALTER TABLE `aggregatedWeekly` CHANGE `Id` `Id` INT( 6 ) UNSIGNED NOT NULL AUTO_INCREMENT

UPDATE

I have also recently found out that the following works just as well:

SQL:
  1. ALTER TABLE `aggregatedWeekly` AUTO_INCREMENT=1


About this entry