Table Relationships

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 3

One to One

Parent table Primary Key has to be included as


Primary Key in Child Table referencing parent
table primary key

CUSTOMER ADDRESS
PK CUSTOMER_ID PK, FKCUSTOMER_ID
FIRST_NM ADDRESS_LINE_1
LAST_NM ADDRESS_LINE_2
GENDER STATE
DOB CITY
ZIP
COUNTRY

One to One (As Many To One With Unique)

Establish Many-One relationship by making many


column as Unique

CUSTOMER ADDRESS
PK CUSTOMER_ID PK ADDRESS_ID
FIRST_NM ADDRESS_LINE_1
LAST_NM ADDRESS_LINE_2
GENDER STATE
DOB CITY
Unique, FK ADDRESS_ID ZIP
COUNTRY
One-To-Many

1) Primary Key of One table will become foreign Key of


another
2) The Table which holds the foreign key always represents
many side of the relationship

CUSTOMER ADDRESS
PK CUSTOMER_ID PK ADDRESS_ID
FIRST_NM ADDRESS_LINE_1
LAST_NM ADDRESS_LINE_2
GENDER STATE
DOB CITY
ZIP
COUNTRY
FK CUSTOMER_ID
Many-To-Many

CUSTOMER ADDRESS
PK CUSTOMER_ID PK ADDRESS_ID
FIRST_NM ADDRESS_LINE_1
LAST_NM ADDRESS_LINE_2
GENDER STATE
DOB CITY
ZIP
COUNTRY

CUSTOMER_ADDRESS
PK,FK CUSTOMER_ID
PK,FK ADDRESS_ID

You might also like