I have been coding MySQL databases for several years now and I have never used a foreign key. Now I understand that a foreign key is similar to an ID on one table, which corresponds to the primary key of another table. I have a user table on my site and probably about 10 other tables that correspond to the main key of my user table - however they are not set as foreign keys.
What did I miss without having these 10 other tables, is there a foreign key? I mean, as far as I can tell, they are basically a foreign key, except that they do not have the value stored / assigned to them in the database.
Is there any other advantage here that I just don't know about?
I also understand that the primary key cannot be null, but it can also be a foreign key. This will never be a problem in my case, since my user table is created, and when a new user is added to my user table, I add their corresponding entry to 10 other tables.
source
share