Course Content

  • learn_vern (1)
  • learn_vern (2)


A FOREIGN KEY is a field (or set of fields) in one table that refers to the PRIMARY KEY in a different table. The child table is the one with the foreign key, while the referred or parent table is the one with the primary key.

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

In relational database design, the FOREIGN KEY constraint is critical. It allows us to link data based on our requirements. It also helps us determine what to do with ON UPDATE and ON DELETE actions done on the rows of the primary table because it introduces certain dependencies between the columns of the primary and foreign tables.

Foreign keys do have an influence on INSERT, UPDATE, and DELETE statements because they execute data checks, but they also increase a database's overall performance. Foreign keys' main advantage is that they guarantee data consistency, which means that they keep the database clean.

At the data level, foreign keys assist maintain referential integrity. They also help with performance because they're usually indexed. Create an index if you require one, but FKs should not be used for this purpose.

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere