The primary key identifies the unique record in a table on the "one side" of the relationship. A foreign key is a key on a table that is the same as the primary key of another table. The foreign key represents the "many side" of the relationship. In this case the foreign key is non-unique.
A couple of examples may help. Suppose we have a part number table. Each part is identified by a unique key, part identifier - the primary key of the table. Suppose we also have a order item table showing all parts on a customer order. The order item table would contain the part identifiers - foreign keys - that related the order to parts on the part table. There could be many occurrences of the same part on the order item table.
We might also have an inventory location table that listed part inventory by location. Again the part identifier would be used as a foreign key and would be used in multiple or many records in the inventory location table. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it if you have time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.