0% found this document useful (0 votes)
2 views2 pages

DBMS Program2

The document outlines steps to manage an Employee table in a database, including creating the table, adding a commission column, inserting records, updating job details, renaming a column, and deleting an employee. It provides SQL commands for each operation, demonstrating how to manipulate the data effectively. The operations are performed within a database named 'lab2'.

Uploaded by

iqra.khanum31
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

DBMS Program2

The document outlines steps to manage an Employee table in a database, including creating the table, adding a commission column, inserting records, updating job details, renaming a column, and deleting an employee. It provides SQL commands for each operation, demonstrating how to manipulate the data effectively. The operations are performed within a database named 'lab2'.

Uploaded by

iqra.khanum31
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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;

You might also like