Primary and Surrogate Keys
Learn about keys in PostgreSQL.
We'll cover the following
Primary key
Primary keys are a database constraint allowing us to implement the first and second normal forms. The first rule to follow to reach the 1NF says, “there are no duplicated rows in the table.”
A primary key ensures two things:
-
The attributes that are part of the primary key constraint definition are not allowed to be
null
. -
The attributes that are part of the primary key are unique in the table’s content.
Get hands-on with 1400+ tech skills courses.