About 30,300,000 results
Open links in new tab
  1. SQL FOREIGN KEY - W3Schools

    The FOREIGN KEY constraint is a key used to link two tables together. A FOREIGN KEY is a field (or collection of fields) in one table that refers to the PRIMARY KEY in another table.

  2. How to Create a Table With a Foreign Key in SQL?

    Nov 27, 2024 · A foreign key is a column or a set of columns in one table that references the primary key of another table. Foreign keys are used to establish and enforce a link between …

  3. SQL FOREIGN KEY Constraint (With Examples) - Programiz

    In SQL, the FOREIGN KEY constraint is used to create a relationship between two tables. A foreign key is defined using the FOREIGN KEY and REFERENCES keywords. Example

  4. The Essential Guide To SQL Foreign Key Constraint

    This tutorial helps you understand SQL foreign key and show you how to define a foreign key using the FOREIGN KEY constraints.

  5. What Is a Foreign Key in SQL? - LearnSQL.com

    Nov 27, 2020 · Learn the ABCs of foreign keys in five minutes. Foreign keys are a central concept in SQL databases; they allow us to enforce data consistency. Usually they work with primary …

  6. Adding a Foreign Key to an Existing SQL Table - Baeldung

    Oct 22, 2024 · We can add a foreign key to any existing SQL table. To do this, we use the ALTER TABLE statement with the ADD CONSTRAINT clause. The general syntax is as follows: ADD …

  7. SQL Foreign key

    Apr 5, 2019 · In this article let us review different ways to create a SQL foreign key, rules on updates and deletes, enabling foreign key constraints, disabling foreign key constraints and …

  8. SQL Server: Foreign Keys - TechOnTheNet

    This SQL Server tutorial explains how to use Foreign Keys in SQL Server with syntax and examples. A foreign key is a way to enforce referential integrity within your SQL Server database.

  9. How to Create a Foreign Key in SQL Server (T-SQL Examples)

    Aug 17, 2019 · In this article I demonstrate how to create a foreign key in SQL Server using Transact-SQL. I demonstrate how to create a foreign key at the time of creating the table (as …

  10. SQL Foreign Key Constraint - GeeksforGeeks

    Jan 15, 2025 · The syntax to create a foreign key in CREATE TABLE statement is: CONSTRAINT fk_constraint_name FOREIGN KEY (column1, column2, ...) REFERENCES parent_table …

  11. Some results have been removed
Refresh