LIVE Course for free

Rated by 1 million+ students
Get app now
JEE MAIN 2023
JEE MAIN 2023 TEST SERIES
NEET 2023 TEST SERIES
NEET 2023
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
11.0k views
in Information Technology by (71.0k 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 (75.9k 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

...