...

/

Answer: The PRIMARY KEY Constraint

Answer: The PRIMARY KEY Constraint

Find a detailed explanation of how to apply primary key constraint on a table.

Solution

The solution is given below:

Press + to interact
/* The query to modify the existing table's settings */
ALTER TABLE Employees
MODIFY EmpID INT AUTO_INCREMENT PRIMARY KEY;
/* Retrieve the structure of the table */
DESC Employees;

Explanation

The explanation of the solution code is given below:

  • Line 2: The ALTER TABLE query modifies a table. The MODIFY clause specifies which column to modify. The AUTO_INCREMENT sets the column to increase the number automatically when a new row is added. Finally, PRIMARY ...