Constraint used in SQL- Indian Bro Code

Опубликовано: 18 Май 2026
на канале: Indian Bro Code
25
1

In SQL, constraints are rules applied to columns in a table to ensure the integrity, accuracy, and reliability of the data in the database. Constraints define how data is entered, updated, and deleted, and they help prevent incorrect or inconsistent data from being stored.

NOT NULL - Ensures that a column cannot have a NULL value

UNIQUE - Ensures that all values in a column are different

PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table

FOREIGN KEY - Prevents actions that would destroy links between tables

CHECK - Ensures that the values in a column satisfies a specific condition

DEFAULT - Sets a default value for a column if no value is specified

CREATE INDEX - Used to create and retrieve data from the database very quickly