SQL Constraints

Prev Tutorial Next Tutorial

SQL Constraints

Constraints is a mechanism which is used to stop or Restrict invalid data which is entered by the end user.


We can apply the constraints in two situations

  • During creation of table
  • After creation of table

We can apply the constraints in two level on the table.

  • Column level constraints
  • Table level constraints

Column level constraints

Applying the constraints after defined the column immediately than those constraints called as column level constraints.

Table level constraint

Applying the constraints after defined all the column of the table or end the table if apply the constraints than these constraints called as table level constraints.


CREATE TABLE table_name
column_name1 data_type(size) constraint_name,
column_name2 data_type(size) constraint_name,
column_name3 data_type(size) constraint_name,

Constraints in SQL

  • Unique key
  • Not NUll
  • Primary key
  • Check
  • Foreign key
  • Default

Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements