Back to Notes

Basics

Primary Key

  • It is a column or a group of columns which uniquely identifies each rows in the database table.
  • Each table can have one and only one primary key.
  • The primary key doesn't have to be ID column always. It's up to you to decide which column uniquely identifies each record.

UNIQUE Constrains

  • A unique constrain can be applied to any column to make sure each record have unique values for that column

NULL Constrain

  • By default, when adding a new entry to database, any column can be left blank. when a column is left blank it has a null value.
  • If you need column to be properly filled in to create a new record, a NOT NULL constraint can be added to the column to ensure that the column is never left blank.