What are the Constraints and list the available constraints in SQL


SQL Constraints are the rules created on tables to control the type of data which goes into a table. Constraints play vital role in filtering invalid data while inserting data into a table. We can create constraints while creating a table or else we can add them to an existing table. Constraints ensures the reliability of a database.

List of constrains available in SQL:

  • Primary Key constraint: Ensures that all the values are unique and not null.
  • Foreign Key constraint: Ensures the referential integrity of data in one table to another table.
  • Unique Constraint: Ensures that all the values are unique.
  • NOT NULL Constraint: Ensures that all the values of the column are not null.
  • Default Constraint: It provides a default value to a column when we are not supplying a value for that.
  • Check Constraint: It ensures that the data which we are inserting into a column satisfies the condition of that column.

Happy Learning :)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.