A-Z Popular Blog Data Search »
Data
 Advertisements
Technology Guides

3 Examples of a Foreign Key

 , updated on
A foreign key is a field or set of fields that are used to establish relationships between rows in a database.

Example (1)

A customer table contains a row for each customer. Each customer row has a foreign key called ADDRESS_ID that points to the customer's address.

Example (2)

A star table contains a row for each known star. Each star row has a foreign key called GALAXY_ID that points to the star's Galaxy.

Example (3)

An actor table contains a row for each actor in a movie database. Each actor row has a foreign key called FAVORITE_ACTOR that points to the id of the Actor's favorite Actor.

Technical Overview

A foreign key is a type of constraint that can be defined for a database. When defined, it helps the database to enforce referential integrity between tables. A foreign key must be defined as a primary key in the parent table. A table can contain a foreign key to itself. A foreign key must exist in the parent table or be null.

Parent & Child

A table with a foreign key is often referred to as a child with the related table being called a parent. The parent/child terminology is a little misleading as the relationship between tables isn't necessarily a hierarchy.

Recursive Foreign Key

A foreign key in a table that refers to itself is known as a recursive foreign key.
Overview: Foreign Key
Type
Definition (1)
A field or set of fields that are used to establish relationships between rows in a database.
Definition (2)
A constraint that indicates a column or set of columns in a table is a reference to the primary key of another table or a self-reference to the table's own primary key.
Value
Establishing relationships between data entities.
Enforcing referential integrity in a database.
Applies to
SQL
Relational Databases
Related Concepts

Data

This is the complete list of articles we have written about data.
Abstract Data
Atomic Data
Big Data
Causality
Cohort
Cohort Analysis
Dark Data
Data
Data Analysis
Data Architecture
Data Attribute
Data Cleansing
Data Collection
Data Complexity
Data Consumer
Data Control
Data Corruption
Data Custodian
Data Degradation
Data Dredging
Data Entity
Data Federation
Data Integration
Data Integrity
Data Liberation
Data Lineage
Data Literacy
Data Loss
Data Management
Data Massage
Data Migration
Data Mining
Data Owner
Data Producer
Data Quality
Data Remanence
Data Risks
Data Rot
Data Science
Data Security
Data States
Data Transformation
Data Uncertainty
Data Veracity
Data View
Data Virtualization
Data Volume
Data Wipe
Decision Support
Deep Magic
Degaussing
Empirical Evidence
ETL
Event Data
Hard Data
Information Assurance
Legacy Data
Machine Data
Market Research
Master Data
Metadata
Metrics
Misuse of Statistics
Overfitting
Personal Data
Personal Information
Predictive Analytics
Primary Data
Primary Research
Privacy
Qualitative Data
Qualitative Info
Quantification
Quantitative Data
Raw Data
Reference Data
Small Data
Soft Data
Source Data
Statistical Analysis
Statistical Population
Structured Data
Transaction Processing
Transactional Data
Types Of Data
Unstructured Data
If you enjoyed this page, please consider bookmarking Simplicable.
 

Data

An overview of data with a list of examples.

Types Of Data

The basic types of data.

Dark Data

The definition of dark data with examples.

Data Massage

The mysteries of data massage.

Data Definition

Several useful definitions of data.

Analytics

A definition of analytics with examples.

Data vs Information

The difference between data and information.

Hard Data vs Soft Data

The difference between hard data and soft data.

Human Readable

A definition of human readable.

Data Loss

The common types of data loss.

Data Quality

An overview of data quality criteria.

Data Corruption

An overview of data corruption.

Data Integrity

An overview of data integrity.

Data Rot

An overview of data rot.

Data Integrity vs Data Quality

The difference between data integrity and data quality.

Data Cleansing

A definition of data cleansing with business examples.

Data Artifact

The common types of data artifact.

Data Veracity

A definition of data veracity with examples.

Data Quality Examples

An overview of data quality with examples.

Legacy Data

An overview of legacy data with examples.
The most popular articles on Simplicable in the past day.

New Articles

Recent posts or updates on Simplicable.
Site Map