Mr. Furxheir, R.M.W. Group: admins (1791 posts total) (last post: November 24, 2007 - 15:07) Citizen #20: Martí- Paìr Furxhéir | > > I hope I was clear enough.. if not, don't hesite to ask further questions !!!
>
> In other words, a Primary Key is the place where the data actually is, and a foreign key is where this data is mirrored somewhere else?
>
NO ! Not at all...
In a relationtional database, tables are related to one another.
For example, a CosaSeat belongs to a citizen.
As such, the CosaSeat will have a ForeignKey that is composed of the field of the Primary Key of the citizen, in this case, the Citizen Number.
Normally, a Foreign Key doesn't contain any real information : It only references the primary key of another table.
> To change the data in a Foreign Key, you must go to the Primary Key and change it there. Am I correct?
>
No, the primary key is supposed to be non changing, such as a Citizen Number ( unlike a citizen name for example ).
If you change a foreign key, you point to another Related record.
> Can you reference individual cells in a table by way of a Primary Key?
>
Not cells, ROWS. In a Database, each columns is a different field, such as CitizenNumber, CitizenName, CitizenTalossaName, etc...
One or more of these columns are special, they are the primary key. With the primary key of a row, you can UNIQUELY identify a row.
For example, I am citizen 20.
Whenever there is a foreign key called CitizenNumber with the value 20 in it, it talks about me.
For example, if there is a CosaSeat for the 4th Cosâ and the 3rd clark with the CitizenNumber 20, then it means the seat is in relation ( belongs in this case ) with me.
Is that clearer ?
Do you like my stupid hair?
Would you guess that I didn't know what to wear?
I'm just scared of what you think
You make me nervous so I really can't eat.
When you smile, I melt inside
I'm not worthy for a minute of your time
|