Basically i am using the w3 schools tutorials to start a Joins tutorial.
I have a person table with the columns, FirstName LastName Address City Id,
Id being my primary key in this table. When i went to create a new table called the Orders table.. I stumbled across the thought, Right i need to add the Id from the person table into this as a foreign key so decided to name is Person, my query is i don't understand is if i set a primary key in my person table to Id and then a foreign key in the orders table to Person, how does the table know that these are the same as in the Person table it is ID and in the order table it is Person,
Surely it cant just be because the data types are the same?
As you can see i am a bit confused by the whole primary key and foreign key business when it comes to actually putting it into practice i understand the basics that a primary key is a unique column designated to idenitfy all table records. And a foreign key being the primary key of another table.
I hope that makes sense. Any answers will be massively appreciated as this seems to be the first major stumbling block and seems as if it needs to be nipped in the bud before i can start moving forward at pace in the database world!