Database Management System (BCS403)
2• Create a table called Employee that contain attributes EMPNO, ENAME, JOB, MGR, SAL
& execute the following.
• Add a column commission with domain to the Employee table.
• Insert any five records into the table.
• Update the column details of Job
• Rename the column of Employ table using alter command.
• Delete the employee whose Empno is 105.
create database lab2;
use lab2;
create table employee (empno int,ename varchar(30), job varchar(l 0),mgr int,sal int);
desc employee;
1. Add a column commission with domain to the Employee table
alter table employee add(commission int);
desc employee;
2. Insert any five records into the table.
INSERT INTO employee (empno,enamejob,mgr,sal,commission) VALUES (101, 'Kavana Shetty',
'Manager', I, 5000.00, I 000.00);
INSERT INTO employee (empno,enamejob, mgr,sal,commission) VALUES (102, 'Ram Charan',
'Developer', 2, 4000.00, 200);
INSERT INTO employee (empno,enamejob, mgr,sal,commission) VALUES (103,
'Singh','Saleman',3, 3000.00, 500.00);
INSERT INTO employee (empno,enamejob, mgr,sal,commission) VALUES (104, 'Laxman',
'Trainer', 4, 4000.00, 200);
INSERT INTO employee (empno,enamejob, mgr,sal,commission) VALVES ( 105, 'Mahender',
'Analyst',5, 3000.00, 500.00);
Select * from employee;
3. Update the column details ·or job
update employee set job='trainee' where empno= 103;
Select * from employee;
3
I
Database Management S
Ystern (ll
4. Rename the column of Employ table using alter command. C¾
alter table employee rename column mgr to manager_no;
desc employee;
S. Delete the employee whose Empno is 105
delete from employee where empno=IOS;
Select • from employee;