Category MySQL

MySQL DEFAULT Constraint

The DEFAULT constraint in MySQL automatically assigns a default value to a column in a table. It provides the default value when no value is specified for that column in an INSERT statement. The DEFAULT value can be a literal…

CHECK Constraint in MySQL

The CHECK constraint in MySQL allows you to define a condition that data must satisfy before it can be inserted into or updated in a table. For example, suppose you have a student’s age field defined in a CREATE TABLE…

FOREIGN KEY in MySQL

FORGEIN KEY in MySQL

A FOREIGN KEY in MySQL is a constraint that establishes a link between two tables. It simply connects a column in one table to the PRIMARY KEY or UNIQUE KEY in another table. A FOREIGN KEY is a column or…

PRIMARY KEY in MySQL

A PRIMARY KEY in MySQL is a constraint that uniquely identifies each row in a database table. It ensures that the values in a specified column or combination of columns are unique and not NULL. A table can contain only…

MySQL UNIQUE Constraint

A UNIQUE constraint in MySQL ensures that all values in a column or a group of columns are distinct across every row in a table. In simple words, the UNIQUE constraint prevents duplicate data from being inserted into a column…