ALERT

[WEBINAR] Application Running Slowly? Time to Get Precise

One-to-Many Relationship

Definition - What does One-to-Many Relationship mean?

In relational databases, a one-to-many relationship occurs when a parent record in one table can potentially reference several child records in another table. In a one-to-many relationship, the parent is not required to have child records; therefore, the one-to-many relationship allows zero child records, a single child record or multiple child records. The important thing is that the child cannot have more than one parent record.

The opposite of a one-to-many relationship is a many-to-many relationship, in which a child record can link back to several parent records.

Techopedia explains One-to-Many Relationship

Consider a database for recording sales information in a store. There are two tables in this database:

  • The CUSTOMER table: This is used for storing customer master details. Its primary key is the CUST_ID column.

  • The SALES table: This is used for keeping track of individual sales transactions.

The SALES table contains the CUST_ID foreign key, which references the column of the same name in the CUSTOMER table to track the customer to whom the sale was made. A single sales transaction can only apply to one customer, but one customer can have many sales transactions over the course of time. This logic is what is defined by the one-to-many relationship. One, in this example, is one customer to many sales transactions.

The one-to-many relationship is only a principle of database design, which cannot be explicitly defined in the database structure. Instead, it is implicitly created and enforced by the use of relationships between tables, especially the relationship between a primary key and a foreign key.

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
Tweat cdn.techopedia.com
"Techopedia" on Twitter


'@Techopedia'
Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Resources

JOIN US AT THWACKCAMP 2016:
THWACKcamp is an annual IT knowledge share event hosted by THWACK, the SolarWinds community of 130,000+ members. It's a two day event (September 14 -...
Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomics
Free 30 Day Trial – Turbonomics:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.