MySQL Unique Constraint

Profile picture for user arilio666

A unique key constraint in MySQL is used to identify individual records in the database. Similar to the primary key, but here null values are allowed unline. It is not permitted in the primary key, and it can be used on more than one column of the database.

Add Unique Constraint in MySQL

CREATE TABLE office (
emp_ID int UNIQUE,
emp_fName varchar(255) NOT NULL,
emp_lName varchar(255) NOT NULL,
Age int
CHECK(Age <= 50)

);
Tags