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

Program-5 Payroll Table

The document creates a payroll table with employee details like ID, name, department, salary components. It inserts sample employee records and adds a net pay column. It then writes SQL queries to update net pay, sort by net pay, filter by department and salary ranges, and sort in descending order.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Program-5 Payroll Table

The document creates a payroll table with employee details like ID, name, department, salary components. It inserts sample employee records and adds a net pay column. It then writes SQL queries to update net pay, sort by net pay, filter by department and salary ranges, and sort in descending order.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

5.

PAYROLL TABLE
SQL> create table payroll(empno number(8), empname varchar(8), department varchar(10), basicpay
number(8,2), hra number(6,2), da number(6,2), pf number(6,2));
Table created

SQL> insert into payroll values(1001,’anu’,’sales’,1000,200,500,600);

SQL> insert into payroll values(1002,’abi’,’marketing’,2000,1200,900,700);

SQL> insert into payroll values(1003,’mani’,’sales’,3000,1600,600,500);

SQL> insert into payroll values(1004,’ravi’,’purchase’,2000,1300,500,200);

SQL> insert into payroll values(1002,’ram’,’production’,4000,900,600,400);

SQL> alter table payroll add(netpay number(8,2));


a) Update the records to calculate the net pay.
SQL> update payroll set netpay=basicpay+hra+da-pf
b) Arrange the records of the employees in ascending order of their net pay.

SQL> select*from payroll order by (netpay);

c) Display the details of the employees whose department is "Sales".


SQL> select*from payroll where department=’sales’;

d) Select the details of employees whose HRA>= 1000 and DA<=900.


SQL> select*from payroll where hra>=1000 and da<=900;

e) Select the records in descending order.

SQL> select8from payroll order by (netpay) desc;

You might also like