MYSQL DATABASE INTERVIEW QUESTIONS
What is a UNIQUE constraint in MySQL?
How do you add a UNIQUE constraint to a column when creating a table?
Can a table have multiple UNIQUE constraints?
How can you add a UNIQUE constraint to an existing table?
What happens if you try to insert duplicate values into a column with a UNIQUE constraint?
Can a UNIQUE constraint be applied to multiple columns together? Explain with an example.
In this case, the combination of ProductID and CustomerID must be unique, meaning that no two rows can have the same pair of ProductID and CustomerID values.
How can you drop a UNIQUE constraint from a table?
What are the differences between a UNIQUE constraint and a PRIMARY KEY in MySQL?
Given the table definition below, identify the error in the UNIQUE constraint implementation and correct it.CREATE TABLE Students ( StudentID INT, FirstName VARCHAR(100), LastName VARCHAR(100), UNIQUE (FirstName, LastName), UNIQUE (StudentID) );
