Question: Convert SQL into PSQL Query 1: Produce a list of current salary, monthly salaries, new salaries (monthly with 20% increase) for all staff, showing staff

Convert SQL into PSQL

Query 1: Produce a list of current salary, monthly salaries, new salaries (monthly with 20% increase) for all staff, showing staff number, first and last names, and salary details.

select fname, lname, salary as "Current Salary", (salary /12) "Monthly Salary", salary + (salary * 20/100) "New Salary" from staff;

Query 2: List all staff whose salary is greater or equal than the average salary of staff working in Branch B010, and show by how much.

select staffno, fname, lname, position, salary - (select avg(salary) from staff) as Sal from staff where salary >= (select avg(salary) from staff) and branchno = 'B010';

Query 3: Find name of owners that the rent of their property is larger than all properties handled by branch B010.

select property_for_rent.ownerno, fname, lname from private_owner

inner join property_for_rent

where rent >= (select sum(rent) from property_for_rent) and property_for_rent.ownerno = private_owner.ownerno group by fname having branchno = 'B010';

Query 4: For total rent collected for properties located in different cities, list the cities and property with the highest rent collected

select propertyno, type, city, sum(rent) from property_for_rent;

Query 5: List properties handled by staff at Burmingham.

select propertyno, street, city, type, fname, position

from property_for_rent

inner join staff

where property_for_rent.branchno = staff.branchno and city = 'Burmingham';

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!