Field referencing the primary key of its own table?
I am introducing some year 10 students to databases. We are using Access2003 at the moment, and I am about to show them SQL (via Access).
I have two questions which I will post seperately.
I am trying to achieve the following:
I have a database with basic information about a person (ID, first, last, DOB, mother, father).
Currently we are playing with determining children by querying WHERE persons.mother = 'Lisa Jones'.
I would like to change the 'mother' and 'father' fields into foreign keys ... on the same table. Is this possible? (I doubt it), so what is the correct way to do this?
A person in a table can be the parent of another person in the same table. So yes you can use a foreign key that refers to the same table.
Another example is a list of employees where many have a direct boss, who is also an employee in the same table.
You can try this by opening the relationship window, then use Show Table to show the same one twice, then make a foreign key in the normal way.
I think...
Bookmarks