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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
