Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relationships: Primary/ Foreign keys???

Status
Not open for further replies.

lorirobn

MIS
Mar 15, 2005
450
US
Hi,

I have an Access database that I have just put onto a SQL Server. I am in the process of creating relationships on the server (or rather, learning how to do so).

I am starting on two tables, RoomHeader and GuestRoom. They both have RoomNumber as their primary key. (GuestRoom tbl is a subset of RoomHeader). When I create relationships on SQL Server, it calls the RoomHeader key a primary key, but the GuestRoom key a foreign key. I thought foreign key was a field that was not a primary key, so why is RoomNumber on GuestRoom being called foreign key? Is it just because it is linked to a primary key on another table?

Thank you,
Lori
 
Yes. Any column inclusing a primary key can be a forign key. A forign key is defined as any column that has a parent child relationship with the primary key of another table.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top