+2 votes
in Class 12 by kratos

Ms. Shalini has just created a table named “Employee” containing columns Ename, Department, Salary.

After creating the table, she realized that she has forgotten to add a primary key column in the table. Help her in writing SQL command to add a primary key column empid. Also state the importance of Primary key in a table.

1 Answer

+2 votes
by kratos
 
Best answer

SQL command to add a primary key column:

Alter table employee add empid int primary key;

Importance of Primary key in a table:

Primary key column is used to uniquely identify each record of the table. A column defined as primary key cannot have a duplicate entry and can't be left blank.

...