Fact-checked by Grok 2 weeks ago

Foreign key

In relational database management systems, a is a column or set of columns in one that refers to the or a in another , thereby establishing and enforcing a between the two tables. This mechanism ensures that the values in the foreign key column must match existing values in the referenced key, preventing the insertion of invalid or orphaned data. The concept of the foreign key originated in the of , introduced by in his seminal 1970 paper, "A Relational Model of Data for Large Shared Data Banks." In Codd's framework, a foreign key is defined as a domain (or combination of domains) in a R that is not the primary key of R but whose values correspond to the of another S, enabling cross-referencing and structured organization without the complexities of earlier hierarchical or network models. This design promotes and , allowing complex relationships to be represented through simple linkages while maintaining logical consistency. Foreign keys play a critical role in upholding , a core principle of relational databases that guarantees the validity of references between tables. In practice, database systems like SQL Server and implement foreign key constraints to control operations such as inserts, updates, and deletes: for instance, an insert into the dependent table (containing the foreign key) requires the foreign key value to exist in the parent table's key, while delete operations on the parent table may trigger actions like cascading deletes or restrictions to avoid breaking links. By enforcing these rules, foreign keys support scalable in applications ranging from business transactions to scientific databases, reducing redundancy and errors in multi-table environments.

Fundamentals

Definition

In relational databases, data is organized into tables, which are structured collections consisting of rows (representing individual records or tuples) and columns (representing attributes or domains). A foreign key is a field, or a collection of fields, in one that uniquely identifies a row of another or the same , thereby establishing a link between datasets. The concept was introduced by E. F. Codd in his seminal 1970 paper, "A Relational Model of Data for Large Shared Data Banks," as a mechanism within the to manage cross-references between and promote data consistency. Specifically, Codd defined a foreign key in a R as a domain (or combination of domains) that is not the of R but whose elements are values from the of another relation S, where S may be identical to R. Key properties of foreign keys include the requirement that their values must either match existing values in the or a of the referenced table or be if the permits values, which allows for optional relationships without violating data consistency. This matching enforces at a foundational level by ensuring that links between tables remain valid and prevent orphaned records. Foreign keys thus depend on primary keys or keys for their referential function, creating directed relationships that support structured data navigation across tables.

Relation to Primary Keys

A primary key is a column or set of columns in a table that uniquely identifies each row, ensuring that no two rows can have the same key value and that all key values are non-null. Primary keys are designed to be immutable, meaning their values should not change over the lifetime of the row to maintain stable references across the database. This immutability supports the integrity of relationships in the , as originally outlined by E.F. Codd, where each declares a primary key to enforce uniqueness. Foreign keys establish links between tables by referencing the (or a ) of another table, thereby creating associations that prevent the creation of orphaned records—rows in one table that refer to non-existent rows in the related table. This referential mechanism ensures that data in the foreign key column matches an existing value in the referenced or column, upholding consistency across related tables. While s focus on enforcing uniqueness and entity integrity within a single table, foreign keys extend this by maintaining across multiple tables, allowing the database to represent complex relationships like one-to-many associations. For instance, in a database tracking orders, the orders table might include a foreign key column that references the (such as customer ID) in the customers table, ensuring every order is tied to a valid customer without allowing references to deleted or invalid customer records.

Theoretical Foundations

Role in the Relational Model

In E. F. Codd's , introduced in , data is structured as relations—mathematical sets of tuples—typically represented as tables where tuples correspond to rows and attributes to columns. Foreign keys provide the essential mechanism for interconnecting these relations, defined as a domain or combination of domains in one relation that is not its but whose values match those of the in another relation, thus establishing logical links between data entities without relying on physical pointers or hierarchical navigation. This approach ensures that relationships are expressed declaratively through data values, promoting and flexibility in large shared data banks. Within relational algebra, foreign keys enable seamless integration of relations through operations like the natural join, where matching attribute values—specifically foreign keys aligning with primary keys—allow tuples from different relations to be combined automatically, supporting complex queries without requiring explicit linkage specifications. This representation simplifies algebraic manipulations, such as projections and selections across related data, while preserving the model's foundational emphasis on and first-order predicate logic for data manipulation. Codd later formalized expectations for relational database management systems in his 12 rules (1985), with Rule 10—Integrity Independence—directly highlighting the role of foreign keys in maintaining . This rule mandates that all integrity constraints, including those enforced by foreign keys to prevent dangling references, be specified and stored separately in the system catalog, independent of application programs, allowing modifications to constraints without altering user views or external code. The theoretical foundations of foreign keys evolved into practical implementations during the 1970s with IBM's System R prototype, which operationalized Codd's model and paved the way for standardized relational systems.

Contribution to Normalization

Database normalization is the process of organizing data in a relational database by decomposing larger tables into smaller, related tables to minimize redundancy and dependency issues, thereby achieving specific normal forms such as first normal form (1NF), second normal form (2NF), and third normal form (3NF). This structured approach ensures that data representation remains stable amid growth or changes in usage patterns, facilitating easier maintenance and control. In achieving 2NF and 3NF, foreign keys play a crucial role by establishing references between decomposed s, allowing non-key attributes to depend fully on the entire (2NF) and eliminating transitive dependencies (3NF). For instance, in separating data from s, a foreign key in the orders table references the primary key in the customers table, preventing duplication of customer details across multiple order records. This linkage maintains the of relationships without embedding redundant information. Foreign keys contribute to anomaly prevention by enforcing that referenced records exist in the parent table, thus avoiding insertion anomalies (e.g., inability to add a without a valid ), update anomalies (e.g., inconsistent updates across orders), and deletion anomalies (e.g., loss of order details when deleting a ). In a normalized design, these mechanisms ensure that dependent data remains consistent and accessible, reducing the risk of data inconsistencies during modifications. A representative example illustrates this in an employees and departments scenario. In an unnormalized table, employee records might include repeated department names, leading to 3NF violations due to transitive dependencies (e.g., employee details depending on department name, which depends on department ID). Normalizing to 3NF involves creating a separate with a (DeptID) and an Employees where DeptID serves as a foreign key referencing Departments, eliminating redundancy and anomalies.
Unnormalized Employees Table
EmpIDEmpNameDeptNameDeptLocation
101AliceNYC
102BobNYC
103Carol
Normalized Departments Table
DeptID (PK)DeptName
1
2
Normalized Employees Table
EmpID (PK)EmpName
101Alice
102Bob
103Carol
This , linked via the foreign key, ensures updates to details occur in one place, preventing propagation errors.

Declaration in SQL

In the SQL standard, foreign keys are declared using the FOREIGN KEY clause within a CREATE [TABLE](/page/Table) or ALTER [TABLE](/page/Table) statement, specifying the referencing column(s) and the referenced table and column(s). The basic syntax for a table-level in CREATE [TABLE](/page/Table) is:
CREATE TABLE child_table (
    column1 datatype,
    column2 datatype,
    [FOREIGN KEY (column2) REFERENCES parent_table (primary_column)](/page/Foreign_key)
);
This establishes a referential relationship where column2 in child_table must match values in primary_column of parent_table. Similarly, for adding a foreign key to an existing table via ALTER TABLE:
ALTER TABLE child_table
ADD [CONSTRAINT](/page/Constraint) fk_name
FOREIGN KEY (column2) REFERENCES parent_table (primary_column);
The CONSTRAINT keyword allows naming the foreign key (e.g., fk_name), which is optional but recommended for clarity and management; unnamed constraints receive system-generated names. Foreign key columns can permit NULL values by default unless explicitly declared NOT NULL, allowing optional relationships. Foreign key declarations were introduced in the SQL-92 standard (ANSI X3.135-1992, also known as ISO/IEC 9075:1992), which formalized referential integrity constraints to link tables in relational databases. Subsequent revisions, including SQL:2016 (ISO/IEC 9075-1:2016), enhanced support for deferrable constraints, enabling checks to be postponed until transaction commit rather than immediate enforcement after each statement. Deferrable foreign keys are declared with the DEFERRABLE or NOT DEFERRABLE clause, optionally set to INITIALLY DEFERRED (checked at commit) or INITIALLY IMMEDIATE (checked immediately, but deferrable if altered). Referential actions can also be specified briefly using ON DELETE and ON UPDATE clauses, such as CASCADE (propagate changes), SET NULL (set to null), SET DEFAULT (set to default), RESTRICT (prevent action), or NO ACTION (similar to RESTRICT, but deferrable); these are detailed in later sections on integrity. Database implementations vary in foreign key support while aiming for SQL standard compliance. In , foreign keys are supported only by the storage engine, requiring explicit table creation with ENGINE=InnoDB and indexes on both foreign and referenced columns; other engines like do not enforce them. provides full SQL-standard-compliant support for foreign keys across all tables, including deferrable constraints and all referential actions. These variations ensure portability issues are considered when designing cross-database schemas.

Enforcement in Database Systems

Database management systems (DBMS) enforce foreign key constraints by validating during data manipulation operations such as INSERT, , and DELETE statements. This enforcement ensures that values in the foreign key column always match an existing value in the referenced or of the . checks are performed in by default in most DBMS, where the system immediately verifies the before committing the . For instance, during an INSERT or , the DBMS queries the referenced to confirm the foreign key value exists; if not, the operation fails with an error. Some systems, like , support deferred constraint checking, allowing violations to be validated at the end of a rather than at each , which is useful for complex operations involving multiple related tables. In , this deferral can be enabled using the DEFERRABLE during creation, postponing checks until COMMIT to improve performance in bulk scenarios. To optimize enforcement, DBMS often automatically leverage indexes on foreign key columns, which accelerate the lookup process during validation and enable efficient JOIN operations between related s. Without an index, checks may require full table scans, leading to significant degradation, especially in large datasets; indexing reduces this overhead by allowing rapid existence verification via or similar structures. For example, SQL Server recommends indexing foreign keys to minimize query costs in referential checks. Major DBMS provide robust system-level support for foreign key enforcement. In , constraints are validated through the database engine's integrity checker, which integrates with the SQL parser and optimizer to enforce rules transparently during DML operations. SQL implements foreign key relationships via the sys.foreign_keys catalog view, where the enforcement engine performs automated checks and logs violations in the error log if needed. MySQL's storage engine handles enforcement by scanning the parent table index during operations, ensuring consistency across transactions. Enforcement introduces performance overhead due to the additional validation queries, particularly in high-volume environments, but DBMS offer mechanisms to mitigate this. For bulk data loads, temporary disabling of checks is common; allows this via SET FOREIGN_KEY_CHECKS=0, which skips validations until re-enabled, followed by a manual verification to catch any inconsistencies. Similarly, provides the ALTER SESSION DISABLE CONSTRAINT option for session-specific deferral during ETL processes, balancing integrity with efficiency.

Referential Integrity

Constraint Mechanics

Referential integrity is the principle enforced by foreign key constraints that mandates every non-null value in a foreign key column—or set of columns—to match an existing value in the referenced or of the parent table. This rule preserves the logical consistency of relationships across tables by preventing the insertion or update of invalid references that could lead to orphaned data. values in foreign keys are permitted, as they represent optional relationships without violating integrity. Foreign key constraints are categorized as simple or compound based on the number of columns involved. A foreign key constraint references the parent key using a single column, where validation ensures the value directly corresponds to an existing primary or entry in the . In contrast, a (or composite) foreign key constraint spans multiple columns, requiring the entire combination to match a corresponding in the parent key, with strict in column order, data types, and collations. The validation logic for both types involves a lookup operation against the 's index on the referenced , confirming existence before allowing the child modification to proceed. Compound constraints are particularly useful for modeling complex relationships, such as those requiring multiple attributes for uniqueness, but they increase the complexity of the matching process. Deferrability, a feature standardized in , allows foreign key constraints to be checked at the end of a rather than immediately after each SQL statement. In systems like , constraints declared as DEFERRABLE can be set to INITIALLY IMMEDIATE (default, checking per statement) or INITIALLY DEFERRED (checking at commit), providing flexibility for bulk operations or circular references within a . This mechanism uses commands like SET CONSTRAINTS to control timing, ensuring temporary violations are resolved before the transaction completes, thus maintaining overall without aborting intermediate steps. Not all support deferrability; non-deferrable ones enforce immediate validation to guarantee atomicity at the statement level. Upon violation of a , database systems respond by raising a specific exception to halt the operation and preserve data consistency. For instance, generates ORA-02291, signaling that the attempted foreign key value lacks a matching parent key. This error typically triggers a of the offending statement, logging the violation if an exceptions table is configured via clauses like EXCEPTIONS INTO. In deferrable scenarios, violations are deferred and checked collectively at transaction end, potentially allowing resolution through subsequent statements; otherwise, the entire transaction may fail at commit if unresolved. Such handling ensures is upheld, with the exact response varying by DBMS but always prioritizing prevention of inconsistent states.

Violation Handling Actions

When foreign key constraints are violated during (DML) operations such as INSERT, UPDATE, or DELETE—specifically when deleting or updating a referenced row in the parent table—database management systems (DBMS) invoke predefined handling actions to maintain . These actions are specified via the ON DELETE and ON UPDATE clauses in SQL foreign key definitions, which dictate the response to modifications affecting the parent key. The primary action categories include NO ACTION, , , SET , and SET DEFAULT, applicable independently to ON DELETE (triggered by parent row deletion) and ON UPDATE (triggered by parent key value changes). NO ACTION and prevent the operation by raising an error if dependent child rows exist, ensuring no violation occurs; automatically applies the delete or update to matching child rows; SET assigns to the foreign key columns in child rows (if nullable); and SET DEFAULT assigns the column's default value to those positions. If the ON DELETE or ON UPDATE clauses are unspecified, the default behavior in standards-compliant DBMS such as and MySQL's engine is NO ACTION, which equates to immediate rejection of the operation akin to unless deferred constraint checking is enabled. Oracle similarly defaults to NO ACTION for both clauses, prohibiting changes that would orphan child rows. This implicit restriction preserves data consistency without explicit configuration in many cases. CASCADE actions propagate effects across interconnected tables, potentially spanning multiple levels of relationships; for instance, employs a depth-first traversal to apply changes recursively while detecting and preventing cycles to avoid infinite loops. Non-cascading actions like SET NULL or SET DEFAULT modify only the immediate child rows without further propagation. These mechanisms ensure controlled handling of dependencies in complex schemas. The referential actions originate from the standard (ISO/IEC 9075:1992), which formalized options like , , , , and to address constraint violations systematically. However, implementations vary for compliance; , for example, treats as synonymous with in and does not support deferrable constraints with actions like or , diverging from full SQL standard provisions. supports only for the ON UPDATE clause across all versions, while providing , , and for ON DELETE, whereas offers comprehensive support aligned closely with the standard.

Advanced Features

Composite and Self-Referential Keys

A composite foreign key consists of multiple columns in a referencing that collectively a composite or in the referenced , ensuring across multiple attributes. This configuration is essential for modeling complex relationships where a single column cannot uniquely identify the referenced . In SQL, the syntax for declaring a composite foreign key uses the FOREIGN KEY followed by the list of referencing columns in parentheses, referencing the target and its corresponding columns in the same order and compatible data types. For instance, consider a many-to-many relationship between orders and products implemented via a junction table named order_items. The order_items table might include columns order_id and product_id as separate foreign keys referencing the primary keys of the orders and products tables, respectively. If the referenced primary keys are composite, the corresponding foreign keys would also be composite to match. The SQL declaration could be:
CREATE TABLE order_items (
    order_id INT,
    product_id INT,
    quantity INT,
    PRIMARY KEY (order_id, product_id),
    FOREIGN KEY (order_id) REFERENCES orders(id),
    FOREIGN KEY (product_id) REFERENCES products(id)
);
This setup prevents invalid combinations by enforcing that each order_id exists in the orders and each product_id exists in the products . Junction tables like this are commonly used to resolve many-to-many associations without . To illustrate a true composite foreign key, suppose an order_details table references a composite (order_date, order_number) in the orders :
CREATE TABLE order_details (
    order_date DATE,
    order_number VARCHAR(20),
    line_item INT,
    [PRIMARY KEY](/page/Primary_key) (order_date, order_number, line_item),
    FOREIGN KEY (order_date, order_number) REFERENCES orders(order_date, order_number)
);
Self-referential foreign keys enable a to reference its own , facilitating the representation of hierarchical or recursive structures within a single . The syntax mirrors standard foreign keys but specifies the same name in the REFERENCES clause, with the referencing column typically allowing to accommodate root-level records without parents. For example, in an employees , a manager_id column can reference the id of the same to model reporting hierarchies. The declaration might appear as:
CREATE TABLE employees (
    id INT PRIMARY KEY,
    name VARCHAR(100),
    manager_id INT,
    FOREIGN KEY (manager_id) REFERENCES employees(id)
);
This allows queries like self-joins to traverse the hierarchy, such as retrieving an employee's full chain of managers. Challenges in self-referential keys include the risk of circular references, where updates or deletions could lead to infinite loops if cascading actions are enabled without safeguards; database systems like and mitigate this by prohibiting self-references to the same column and limiting nested cascades. A common use case is modeling bill-of-materials (BOM) in , where a parts table uses a self-referential foreign key (e.g., parent_part_id referencing part_id) to represent assemblies composed of subcomponents, enabling recursive queries for complete product structures. Such designs support arbitrary depth without requiring multiple tables, though they necessitate careful ing for query performance.

Limitations and Alternatives

Foreign key constraints, while essential for maintaining in relational databases, introduce notable performance overhead in large-scale systems. The enforcement of these constraints requires the database to validate relationships during insert, , and delete operations, which can increase computational costs and slow down transactions, particularly in environments with high write volumes. In bulk data loading scenarios, such as extract-transform-load (ETL) processes for data warehouses, this validation can significantly degrade insertion speeds, often prompting temporary disabling of constraints to prioritize throughput. Another limitation arises from the rigidity foreign keys impose on schema evolution. Empirical studies of schemas in open-source projects show that foreign keys are infrequently added, dropped, or altered after initial implementation, leading to "gravitation to rigidity" where tables become locked into static structures that resist adaptation to evolving needs. This , while beneficial for , complicates migrations and refactoring, as changes to one foreign key can across interdependent tables, increasing the risk of errors and . In environments, foreign keys face additional challenges due to models prevalent in systems. architectures, which often employ separate databases per service, lack centralized control for cross-service constraint enforcement, making traditional foreign keys impractical under the theorem's trade-offs favoring and tolerance over immediate consistency. Asynchronous communication via event streams introduces delays and potential duplicates, necessitating custom application logic or sagas to approximate rather than relying on database-level checks. Early debates in the , amid the rise of commercial relational systems, highlighted tensions between database-enforced foreign keys and application-level integrity checks, with proponents of the latter arguing for greater flexibility and reduced overhead in dynamic environments. Modern alternatives address these drawbacks by shifting away from rigid key-based relationships. In document databases like , embedding related data within a single document eliminates the need for foreign keys and joins, improving read performance for one-to-few relationships at the cost of potential data duplication. Graph databases such as model connections as native edges between nodes, avoiding foreign keys altogether and enabling efficient traversal of complex, many-to-many relationships without inferring links via keys. Within relational systems, triggers and stored procedures offer customizable integrity enforcement, allowing developers to implement tailored validation logic that bypasses standard foreign key limitations. Foreign keys should be avoided in high-velocity data ingestion scenarios, like analytics pipelines, where their overhead can bottleneck operations, favoring instead post-ingestion validation at the application to maintain speed.

Practical Examples

Basic Table Relationship

A fundamental example of a foreign key in action involves a Customers table storing customer details, with an id column serving as its primary key, and an Orders table recording purchase details, where a customer_id column acts as a foreign key referencing the id column in the Customers table. This configuration supports a one-to-many relationship, enabling a single customer to be associated with multiple orders while ensuring that all orders link to valid customers. The tables can be defined using standard as follows:
sql
CREATE TABLE customers (
    [id](/page/id) INTEGER [PRIMARY KEY](/page/Primary_key),
    name [VARCHAR](/page/Varchar)(100) NOT NULL
);

CREATE TABLE orders (
    [id](/page/id) INTEGER [PRIMARY KEY](/page/Primary_key),
    customer_id INTEGER NOT NULL,
    order_date DATE NOT NULL,
    FOREIGN KEY (customer_id) REFERENCES customers ([id](/page/id))
);
The FOREIGN KEY constraint in the Orders table declaration mandates that any value in customer_id must correspond to an existing id in the Customers table, thereby upholding during data operations. Successful data insertion requires valid references. For instance:
sql
INSERT INTO customers (id, name) VALUES (1, '[Alice Smith](/page/Alice_Smith)');
INSERT INTO orders (id, customer_id, order_date) VALUES (1, 1, '2023-11-09');
This operation links the order to the existing without issue. In contrast, an attempt to insert an order for a non-existent fails:
sql
INSERT INTO orders (id, customer_id, order_date) VALUES (2, 999, '2023-11-10');
Such an insertion triggers a violation error, as the verifies the reference and rejects the operation to maintain . To demonstrate the linkage, a JOIN query retrieves combined customer and order information:
sql
SELECT c.name, o.order_date
FROM customers c
JOIN orders o ON c.id = o.customer_id;
This query matches rows based on the foreign key, producing results like Alice Smith's order on 2023-11-09, illustrating how related data from both tables can be accessed efficiently. The foreign key mechanism prevents orphan records—orders without corresponding customers—by enforcing valid references at insert, update, or delete time, thus avoiding inconsistencies in the . This one-to-many relationship can be visualized as:
  • Customer (id=1, name='Alice Smith')
    • Order (id=1, customer_id=1, order_date='2023-11-09')
    • (Additional orders for the same customer would nest here)
This structure underscores the parent-child dynamic, with as the table and as the .

Multi-Table Scenario

In a typical multi-table , such as an system, foreign keys connect the Customers, Orders, and Order_Items tables to model hierarchical relationships. The Customers table holds primary customer data with customer_id as the . The Orders table references customer_id via a foreign key to associate orders with customers. The Order_Items table references order_id from Orders via a foreign key configured with ON DELETE CASCADE, ensuring that deleting an order automatically removes its line items. The following SQL declarations establish these relationships in a standard relational database like PostgreSQL or SQL Server:
sql
CREATE TABLE Customers (
    customer_id INTEGER PRIMARY KEY,
    name VARCHAR(100) NOT NULL
);

CREATE TABLE Orders (
    order_id INTEGER PRIMARY KEY,
    customer_id INTEGER NOT NULL,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

CREATE TABLE Order_Items (
    item_id INTEGER PRIMARY KEY,
    order_id INTEGER NOT NULL,
    product VARCHAR(100),
    FOREIGN KEY (order_id) REFERENCES Orders(order_id) ON DELETE CASCADE
);
The ON DELETE CASCADE clause on the Order_Items foreign key propagates deletions from Orders to child records, while the default NO ACTION (equivalent to RESTRICT for updates) on the Orders foreign key to Customers prevents updates that would break references. To demonstrate functionality, sample data can be inserted as follows:
sql
INSERT INTO Customers (customer_id, name) VALUES (1, 'Alice Johnson');
INSERT INTO Orders (order_id, customer_id) VALUES (101, 1);
INSERT INTO Order_Items (item_id, order_id, product) VALUES (1, 101, 'Laptop');
Executing a delete on the Orders table triggers the :
sql
DELETE FROM Orders WHERE order_id = 101;
This removes the order record, which in turn automatically deletes the associated order item due to the ON DELETE [CASCADE](/page/Cascade) enforcement, ensuring no orphaned data remains in Order_Items. The customer record in Customers is unaffected, as the default NO ACTION on its referencing foreign key prevents propagation but allows the operation since the restriction is on the parent side. An edge case arises with update operations under restrictive foreign key rules. For instance, attempting to update the customer_id in Orders to reference a non-existent customer violates the foreign key constraint:
sql
UPDATE Orders SET customer_id = 999 WHERE order_id = 101;
This results in an error, such as "foreign key constraint violation," preventing inconsistent references and upholding data integrity. This multi-table configuration with cascading actions benefits schema-wide consistency by automating the removal of dependent records, reducing the risk of dangling references in complex relationships. A practical query to retrieve a full customer order report joins the tables for a unified view:
sql
SELECT c.name AS customer_name, o.order_id, oi.item_id, oi.product
FROM Customers c
JOIN Orders o ON c.customer_id = o.customer_id
JOIN Order_Items oi ON o.order_id = oi.order_id
WHERE c.customer_id = 1;
Such joins leverage the to efficiently assemble related data without manual integrity checks.

References

  1. [1]
    Primary and foreign key constraints - SQL Server - Microsoft Learn
    Feb 4, 2025 · A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables to control ...
  2. [2]
    Foreign key (referential) constraints - IBM
    A foreign key is a column or a set of columns in a table whose values are required to match at least one primary key or unique key value of a row in its parent ...Missing: relational | Show results with:relational
  3. [3]
    [PDF] A Relational Model of Data for Large Shared Data Banks
    This paper is concerned with the application of ele- mentary relation theory to systems which provide shared access to large banks of formatted data. Except for ...
  4. [4]
    Documentation: 18: 5.1. Table Basics - PostgreSQL
    A table in a relational database is much like a table on paper: It consists of rows and columns. The number and order of the columns is fixed, and each column ...
  5. [5]
    Defining a foreign key - Db2 - IBM
    Use foreign keys to enforce referential relationships between tables. A foreign key is a column or set of columns that references the parent key in the parent ...
  6. [6]
    Documentation: 18: 5.5. Constraints - PostgreSQL
    A primary key constraint indicates that a column, or group of columns, can be used as a unique identifier for rows in the table. This requires that the values ...
  7. [7]
  8. [8]
    Dimensional modeling: Primary and foreign keys - IBM
    A foreign key is a column or a set of columns in a table whose values correspond to the values of the primary key in another table. In order to add a row with a ...
  9. [9]
    Foreign and principal keys in relationships - EF Core - Microsoft Learn
    Mar 30, 2023 · All one-to-one and one-to-many relationships are defined by a foreign key on the dependent end that references a primary or alternate key on the principal end.
  10. [10]
    What Is a Primary Key? - IBM
    A primary key is a column or columns in a database table with values that uniquely identify each row or record.What is a primary key? · Understanding keys and...
  11. [11]
    A relational model of data for large shared data banks
    A model based on n-ary relations, a normal form for data base relations, and the concept of a universal data sublanguage are introduced.
  12. [12]
    The relational model for database management: version 2
    The relational model is solidly based on two parts of mathematics: firstorder predicate logic and the theory of relations.Missing: original | Show results with:original<|control11|><|separator|>
  13. [13]
    [PDF] Further Normalization of the Data Base Relational Model
    In an earlier paper, the author proposed a relational model of data as a basis for protecting users of formatted data systems from the potentially.
  14. [14]
    [PDF] Normalization - Chapter 7: Relational Database Design
    ▫ Insertion anomalies – i.e., if we add a phone 981-992-3443 to 99999, we need to add two tuples. (99999, David, 981-992-3443). (99999, William, 981-992-3443).
  15. [15]
    [PDF] 1.264J Lecture 10 Notes: Database: Data normalization
    – Prevent update anomalies (mistakes) and data inconsistencies. – Degrade ... – Allowed null foreign keys, so they were never filled in. – Design not ...
  16. [16]
    MySQL :: MySQL 8.0 Reference Manual :: 15.1.20.5 FOREIGN KEY Constraints
    ### Summary of Foreign Keys in MySQL (Refman 8.0)
  17. [17]
    SQL Language Reference
    ### Summary of Foreign Key Constraints, Referential Integrity, Deferrable Constraints, and Error Handling from Oracle Database 19c SQL Reference
  18. [18]
    Defining Composite Primary and Foreign Keys - IBM
    You can create a composite key. A composite key specifies multiple columns for a primary-key or foreign-key constraint.<|separator|>
  19. [19]
    ORA-02291 - Database Error Messages - Oracle Help Center
    Oct 13, 2025 · A foreign key value has no matching primary key value. Action. Delete the foreign key or add a matching primary key. ORA-02291. integrity ...
  20. [20]
    MySQL 8.4 Reference Manual :: 15.1.20.5 FOREIGN KEY Constraints
    A foreign key constraint on a stored generated column cannot use CASCADE , SET NULL , or SET DEFAULT as ON UPDATE referential actions, nor can it use SET NULL ...
  21. [21]
    21 Data Integrity
    Definition. Foreign key, The column or set of columns included in the definition of the referential integrity constraint that reference a referenced key.
  22. [22]
    MySQL 8.4 Reference Manual :: 1.7.2.3 FOREIGN KEY Constraint ...
    According to the SQL standard, the default behavior should be deferred checking. That is, constraints are only checked after the entire SQL statement has been ...Missing: 2016 | Show results with:2016
  23. [23]
    Entity Relationships in the order Application
    A self-referential relationship is a relationship between relationship fields in the same entity. Part has a field bomPart that has a one-to-many relationship ...
  24. [24]
    Foreign keys decrease adaptability of database designs
    The problem we have seen with using foreign keys to represent relationships is not so much that they are an alternative representation as that it can be ...
  25. [25]
    Schema evolution and foreign keys: a study on usage, heartbeat of ...
    In this paper, we study the evolution of foreign keys in the context of schema evolution for relational databases. Specifically, we study the schema ...
  26. [26]
    [PDF] Foreign Key Constraints to Maintain Referential Integrity in ...
    In microservices architecture with distributed databases, maintaining data consistency particularly using foreign key constraints for referential integrity is ...
  27. [27]
    [PDF] What Goes Around Comes Around
    This paper provides a summary of 35 years of data model proposals, grouped into 9 different eras. We discuss the proposals of each era, and show that there ...
  28. [28]
    Comparing relational to graph database - Getting Started - Neo4j
    This means you are not required to infer connections between entities using special properties such as foreign keys or out-of-band processing like map-reduce.Relational Database Overview · Translating Relational... · Data Model Differences
  29. [29]
    Specification and Implementation of the Inverse Referential Integrity ...
    Sep 2, 2015 · Those techniques are procedures and/or triggers. Current XML database management systems (XML DBMSs) support constraints like key, foreign ...Missing: alternatives | Show results with:alternatives
  30. [30]
    Documentation: 18: 3.3. Foreign Keys - PostgreSQL
    The new declaration of the tables would look like this: CREATE TABLE cities ( name varchar(80) primary key, location point ); CREATE TABLE weather ( city ...
  31. [31]
    What is a foreign key? (with SQL examples) - CockroachDB
    May 4, 2023 · A foreign key is a column or columns in a database that (eg table_1.column_a ) that are linked to a column in a different table ( table_2.column_b ).
  32. [32]
    DELETE CASCADE and UPDATE CASCADE in SQL Server foreign ...
    Jul 3, 2019 · In this article, we will review on DELETE CASCADE AND UPDATE CASCADE rules in SQL Server foreign key with different examples.
  33. [33]
    Understanding Foreign Keys in Databases - TiDB
    Jul 18, 2024 · ON DELETE CASCADE​​ For example: CREATE TABLE customers ( customer_id INT PRIMARY KEY, name VARCHAR(100) ); CREATE TABLE orders ( order_id INT ...