Announcement

Collapse
No announcement yet.

What is a foreign key in SQL and what is its purpose?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What is a foreign key in SQL and what is its purpose?

    May I know the purpose of using a foreign key in SQL.

  • #2
    A foreign key (FK) is a column or set of columns used to create and enforce a link between data in two tables to limit the amount of data that may be stored in the foreign key table.

    Comment


    • #3
      A foreign key is a column (or set of columns) that refers to another table's column (usually the primary key). The foreign key's function is to ensure the data's referential integrity. To put it another way, only values that should be in the database are allowed.

      Comment


      • #4

        Are foreign keys beneficial to performance?​

        Comment

        Working...
        X