FOREIGN KEY Constraint

SQL FOREIGN KEY Constraint

Submitted by admin on

A FOREIGN KEY is a key in another table that relates from the PRIMARY KEY in the parent table. A Foreign Key is needed in the related table to connect data from the primary table.

Let's take a look at the following example

Course Table

CourseID Course
1 Math 101
2 English 101

Students Table