Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
12.4k views
in Information Technology by (71.3k points)

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

+1 vote
by (76.5k points)
selected by
 
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.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...