hey guys in this video I will show you how to generate the employee details & compute the salary base on the department
Step 1
create table employee(empid number(4), deptid number(2), empname varchar2(25), empsalary number(5));
Table created.
Step 2
desc employee;
Step 3
insert into employee values(1009, 01, 'arun', 25000);
insert into employee values(1010, 02, 'banu', 35000);
insert into employee values(1011, 03, 'ganesh', 15000);
Step 4
select * from employee;
Table TWO (DEPARTMENT)
Step 5
create table department(deptid number(2), deptname varchar2(20), supervisor varchar2(20));
Table created.
Step 6
desc department;
Step 7
insert into department values(01, 'purchase', 'ram');
insert into department values(02, 'accounts', 'divya');
insert into department values(03, 'sales', 'anita');
Step 8
select * from department;
Step 9
Command to find the names of all employees who work for the accounts department:
select * from employee where deptid=(select deptid from department where deptname='accounts');
Step 11
Command to find number of employees who work for the accounts department:
select count(*) from employee where deptid=(select deptid from department where deptname='accounts');
Step 12
Command to find the minimum salary of employees who work for the accounts department:
select min(empsalary) from employee where deptid=(select deptid from department where deptname='accounts');
Step 13
Command to find the maximum salary of employees who work for the accounts department:
select max(empsalary) from employee where deptid=(select deptid from department where deptname='accounts');
Step 14
Command to list the emplaoyees working for a particular supervisor
select * from employee where deptid=(select deptid from department where supervisor='divya');
Step 15
Command to increase the salary of all employees in the sales department by 15%
update employee set empsalary=empsalary+empsalary*0.15 where deptid=(select deptid from department where deptname='sales');
3 row(s) updated.
Step 16
select * from employee;
like share my videos
if you have any suggestion or doubt please leave a comment
thank you for watching
don't forget to subscribe my channel for more learning videos