Primary keys, automated entry?
Date: 06/15/06
(MySQL Communtiy) Keywords: database
Thanks for the responses to my last post, I now have a better understanding regarding primary keys and natural/foreign keys.
Now, after reading online about the topic, I don't see any clear explanation on how the keys are produced. For instance, say I have a foreign key, auto-increment, if I want to enter a song in the database, and it already has the artist entered previously, will it automatically know to give it the right artists_id key if I tell it the name of the artist? Does that make sense? I would assume if the artist isn't already in the database, it will add it and increment the primary key (artist_id), and if it is, it'll just use the primary key that already exists for that artist.
Source: http://community.livejournal.com/mysql/97191.html