1NF does not contain null columns. Therefore, to implement a one-to-one relationship, put the foreign key in the child element (provided that it is a table that may or may not contain a record associated with the parent) that points to the parent. Then use an external connection request from parent to child to get instances where there are parents with and without children.
Example:
Customer Table (i.e., parent)
CID (Primary Key)
Customer_Name
Customer_Address
...
Order Table (i.e., child)
OID (Primary Key)
Ordered_Date
Order_Quantity
... (product ordered would be a foreign key to the Products table; not relevant to discussion)
CID (Foreign Key to Customer table)
SQL:
SELECT Customer.Customer_Name, Order.Ordered_Date, Order.Order_Quantity
FROM Customer
LEFT OUTER JOIN Order
ON Customer.CID = Order.CID (syntax generic)
This will return ALL customer records and link any order made. He will also return Customers who did not have orders.
source
share