Constraints in SQL are used to enforce some set of rules for the table fields and records while creating a table. This set of rules helps in automated data validation and avoids irrelevant data from being stored in these tables. These constraints can be categorised into column-level constraints and table-level constraints. The column-level constraints enforce the set of rules on a single column whereas the table-level constraints apply to the entire table.  Some of the most used constraints are PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, AUTO_INCREMENT, etc.  A NOT NULL constraint would prevent null entries in a certain column. For example, the birth date field in birth records cannot be null. A column can only contain values that fall under the scope of a CHECK constraint. A student percentage field, for instance, may only accept values in a specified range. If a column's value appears in another table row, a UNIQUE constraint will throw an error. This ensures that none of the values in a column are repeated. For example, we might not want to see any repeated value for the mobile number field in a table.  CREATE TABLE knowledgehut_blogs (
blog_id TEXT PRIMARY KEY
blog_title TEXT NOT NULL
page_id INT UNIQUE
); In the above example, the “knowledgehut_blogs” table consists of a PRIMARY KEY constraint to uniquely identify a record, a NOT NULL constraint to avoid blank entries for blog titles, and a UNIQUE constraint to avoid duplication of webpage IDs.