Professional Documents
Culture Documents
TASK 1
Show Company name and decode location
If location is gujranwala, place 1 in result
If location is islamabad , place 2 in result
Else place 0 in result
SELECT
COMPANYNAME,CITY,DECODE(CITY,'GUJRANWALA',1,'ISLAMABAD',2,0) AS
“RESULT”
FROM COMPANY;
TASK 2
Show pack id,speed,monthly payment,and tax applied on monthly payment using the following
criteria
5 % increase If pack id is 1,
12 % increase If pack id is 6 ,
15 % increase If pack id is 2,
20 % increase If pack id is 7,
50 % increase If pack id is 5,
30 % increase If pack id is 8
AND order by Sector Number.
SELECT PID, SPEED, MONPAYMENT,
DECODE(PID,
1,0.05*MONPAYMENT,
6,0.12*MONPAYMENT,
2,0.15*MONPAYMENT,
7,0.20*MONPAYMENT,
5,0.50*MONPAYMENT,
8,0.30*MONPAYMENT) "TAX"
FROM PACKAGE
ORDER BY SID
TASK 3
Show employee name, his company name, old salary and increased salary for the following
criteria:
10% increase IF company name is ‘APPLE’,
50% increase IF company name is ‘FIRST BANK CORPORATION’, 40% increase IF company name is
‘SMALL BANK CORPORATION’,
100% increase IF company name is ‘HBL’,
And same salary for the remaining companies.
Order by new salaries in ascending order.
SELECT EMPNAME, COMPANYNAME, SALARY "OLD SALARY",
DECODE(COMPANYNAME,'APPLE', 1.1*SALARY,
FROM WORKS
TASK 4
Give EMPLOYEE NAME , COMPANY NAME and SALARY as “Incremented Salary” with these
conditions:
If the company name is FIIRSTBANKCORPORATION’, add 20% to salary.
If the company name is ‘SARTE’, add 30% to salary.
If the company name is‘LARGEBANKCORPORATION’, add 60% to salary.
If the company name is ‘SMALLBANKCORPORATION’, add 40% to salary.
If the company name is ‘BINYAPI’, add 90% to salary
SELECT EMPNAME,COMPANYNAME,
DECODE (COMPANYNAME,
'SARTE',1.3*SALARY,
'BINYAPI',1.9*SALARY
) "INCREMENTED SALARY"
FROM WORKS
TASK 5
Show employee name and job name on the basis of salary WHEN salary>100000 THEN 'Manager'
WHEN salary between 50000 and 100000 THEN 'Co manager'
WHEN salary between 25000 and 40000 THEN 'Planer'
WHEN salary between 15000 and 24000 then 'Employee'
ELSE 'intern'
SELECT EMPNAME,
CASE
ELSE 'intern'
END AS "JOBS"
FROM WORKS
TASK 6
Display names of employees and annual bonus as
“Bonus” based on the following criteria:
1. If employee works for ‘First Bank Corp’, bonus is 30% of
annual salary.
2. If employee works for ‘Second Bank Corp’, bonus is 20% of
annual salary.
3. If employee works for ‘Small Bank Corp’, bonus is 5% of
annual salary.
SELECT EMPNAME,
DECODE(COMPANYNAME,
) "BONUS"
FROM WORKS
TASK 7
DISPLAY EMPLOYEE RANKS WITH RESPECT TO THEIR SALARIES I.E.,
If the employee's salary is between 0 to 8100 , rank as JUNIOR.
If the employee's salary is between 8100 to 9200 , rank as SENIOR.
If the employee's salary is between 9200 to 12000 , rank as MANAGER
If the employee's salary is between 12000 to 17100 , rank as SUPERVISOR.
SELECT
CASE
END AS "RANKS"
FROM WORKS
TASK 8
Give name,city,incremented salary of all employees depending to their managers and company
names
Incremented values: if manager is FAZEEL increment 10% in salary
if manager is SAQLAIN increment 15% in salary
if manager is AHMAD increment 20% in salary
DECODE(M.EMPNAME,
'FAZEEL',1.1*W.SALARY,
'SAQLAIN',1.15*W.SALARY,
'AHMAD', 1.2*SALARY,
'SHAHAB', 1.12*SALARY
) "INCREASED SALARY"
WHERE E.EMPNAME=W.EMPNAME
AND E.EMPNAME=M.EMPNAME
TASK 9
Show employee name company name and salary of all employees in database
If company name is FIRST Bank Corporation’ then deduct 5% from salary.
If company name is smart bank corporation’ then deduct 10% from salary.
If company name is ‘small bank corporation’ then deduct 15% from salary.
If company name is ‘brads drink’ then deduct 17% from salary.
If company name is ‘apple computer’ then deduct 20% from salary.
SELECT EMPNAME, COMPANYNAME,
DECODE(COMPANYNAME,
) "DEDUCTED SALARY"
FROM WORKS