Welcome to FindNerd,
Today we are going to discuss about MySQL Constraints.
Firstly let know what is Constraints in MySQL ?
Constraints:- Constraints are the utilities that restrict ingression of data into the table if the designated condition is not consummated.
Constraints have many type in MySQL
There are given bellow:
1- Primary Key
2- Unique Key
3- Foreign Key
4- Not null
1-Primary Key:- Primary key averts duplicate ingress.
Primary key can never be null value.
Primary key signifies inside a table there is only one field can be declared primary.
2-Unique Key:- Unique Key will not enter a duplicate value in the field.
Unique key can be null value in the field.
Unique key also called column based constraint.
3-Foreign Key:- Foreign key is also column based constraint.
Foreign key depends on primary key.
A column is called Foreign key when Foreign key refers to the primary key column of another table.
4-Not null :- Not null will not allow entering null Value in the field.
Not null allow entering duplicate in the field.
0 Comment(s)