मराठी

Ms Shalini has just created a table named “Employee” containing columns Ename, Department and Salary. After creating the table, she realized that she has forgotten

Advertisements
Advertisements

प्रश्न

Ms Shalini has just created a table named “Employee” containing columns Ename, Department and Salary. After creating the table, she realized that she has forgotten to add a primary key column in the table. Help her in writing an SQL command to add a primary key column EmpId of integer type to the table Employee.

Thereafter, write the command to insert the following record in the table:

EmpId- 999
Ename- Shweta
Department: Production
Salary: 26900
टीपा लिहा
Advertisements

उत्तर

SQL Command to add primary key:

ALTER TABLE Employee ADD EmpId INTEGER
PRIMARY KEY;

As the primary key is added as the last field, the command for inserting data will be:

INSERT INTO Employee
VALUES("Shweta","Production",26900,999);
OR
INSERT INTO
Employee(EmpId,Ename,Department,Salary)
VALUES(999,"Shweta","Production",26900);
shaalaa.com
SQL for Data Definition
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×