TechAid24

Your Technical Consultant

Day: September 19, 2026

Difference between Primary Key Vs Foreign key in SQL

Posted on by Selim Ahmed

There are two types of primary key, a simple primary key, and a composite primary key. A simple primary key is made of just one column while a composite primary key is made of more than one columns. Primary key also enforces some constraint e.g. UNIQUE and NOT NULL, which means if you try to enter another record with the primary key already existing in the database than DBMS will reject it.

Continue reading Difference between Primary Key Vs Foreign key in SQL