Jetson wrote:
A caution about foreign keys: as far as I know, MySQL only does constraint checking in one direction. If you add or edit a child record in a table that has a foreign key then it will check to make sure that the parent record referenced by that key exists. If you edit or delete the parent record, it does not trigger a cascade update or cascade delete in the child records. It's up to you to recurse the relationships and clean up the children yourself.
Last but not least, the "auto increment" values in a table are not tracked in a non-user table as they are in Postgres, but instead are determined on the fly by simply adding 1 to the highest index value currently in the file. That can cause problems if you assume that the key value for a deleted record won't be reused.
Both of these are incorrect.
Only InnoDB supports foreign keys, but it does enforce constraints both ways. You can set up foreign keys with various options so that deleting a parent record with a related child will: prevent the parent record from being deleted if a corresponding child exists, delete the child record, set the child's parent ID value to NULL, or do nothing. Same with updates.
Auto-increment doesn't behave that way and never did to my knowledge, unless things were different before I started using it at version 3.23. If you have values of 1,2,3,4,5 and delete #5, the next autoincrement value will still be 6.
BTW, for setting up databases, I'd highly recomment phpmyadmin. It is an excellent administration tool. I've designed many very complex database structures, and it's all I use.