Question

In: Computer Science

Create a query that shows the last name, employee ID, hours worked, and overtime amount owed...

Create a query that shows the last name, employee ID, hours worked, and overtime amount owed for hourly employees who earned overtime during week 2. Overtime is paid at 1.5 times the normal hourly rate for all hours worked over 40. Note that the amount shown in the query should be just the overtime portion of the wages paid. Also, this is not a totals query- amounts should be shown for individual workers. QBE grid template. This is the exact question from the book and the only information it gives me.

Solutions

Expert Solution

So the fact that ther is no schema , the solution is based on these pretty basic assumptions :

  • there is a employee table with eid as primary key.
  • there is a hours table with eid as foreign key.
  • there is wage table where rate and eid is stored.

now the query we want is :

SELECT E.lastname , H.hours , (H.hours - 40 * 1.5 * W.rate)

from employee E , hours H , wage W

where E.eid = W.eid AND E.eid = H.eid AND E.eid IN (SELECT E.eid from

from employee E , hours H

where E.eid = H.eid AND H.week_no = 2 AND H.hours > 40);

So the above query is a nested query .The inner query will search for the all the records whose week_no = 2 and hours wokred > 40 and return their ids as result. Then in the outer query we are searching for those ids and printing the values.

NOTE : the attributes and table may differ so please change them accordingly.


Related Solutions

Problem 44 Write a query to display the employee number, last name, first name, and sum...
Problem 44 Write a query to display the employee number, last name, first name, and sum of invoice totals for all employees who completed an invoice. Sort the output by employee last name and then by first name (Partial results shown in Figure P7.44).
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department...
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department Phone # 0001 John Smith jsmith Accountant 1300 West st 5775 Accounting 2100 8/1998 407-366-5700 0002 Brian Miller badams Admin Assistant 1552 Palm dr 5367 Human resource 2300 4/1995 407-366-5300 0003 James Miller miller Inventory Manager 2713 Buck rd 5432 Production 2520 8/1998 407-366-5400 0004 John Jackson jackson_sam Sales Person 433 tree dr 5568 Sales 2102 6/1997 407-366-5500 0005 Robert Davis Davis Manager 713...
Leticia Alvarez worked 40 hours straight time and 20 hours overtime at an hourly rate of...
Leticia Alvarez worked 40 hours straight time and 20 hours overtime at an hourly rate of $10.50. Of the 20 hours overtime, 8 hours were at double time. Compute the following: 30. Straight-time earnings = 31. Overtime earnings = 32. Gross earnings =
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth Create a table ‘ClassInfo’ table: ID Class Name Class Description Create a table ‘RegisteredClasses’ table: StudentID ClassID The RegisteredClasses table should have a foreign key relationship to StudentInfo and ClassInfo tables for the respective IDs. Also the IDs in StudentInfo and ClassInfo need to be primary keys. When you submit the file your email should also contain the following SQL Queries: Query to show...
List department name, employee id, and employee name for all employees in department name order. Repeat...
List department name, employee id, and employee name for all employees in department name order. Repeat for department #10 only. List the course ID, course name, section, instructor name, day, time, and room for all course sections. List the course ID, course name, section, student ID, and student name for CRN 1003. Display the list in ascending order of student last and first names. DROP TABLE registration; DROP TABLE sections; DROP TABLE courses; DROP TABLE students; DROP TABLE instructors; CREATE...
An employee works 48 hours (48 - 40 were overtime hours) during a workweek in December...
An employee works 48 hours (48 - 40 were overtime hours) during a workweek in December of 2019. He earns $8,000/month, with his employer paying 1.5 times the regular rate of pay for overtime hours. To date, he has earned $110,300 during the year. He has requested that his employer withhold 11.5% of gross pay to contribute to a 403(b) plan. Taxable income for federal income tax withholding = $ Taxable income for social security tax = $ Taxable income...
The system will accept the employee ID, the employee name and his/her gross salary.
The system will accept the employee ID, the employee name and his/her gross salary.Based on the gross salary provided, if it is equal to or greater than OMR 2500, the system should apply a tax rate of 6% when calculating the income tax otherwise a tax rate of 4% should be applied when calculating.calculate the income tax and the net salary,If (gross salary > = 2500)          Tax rate = 6%Else     Tax rate = 4%Income tax = Net salary = 
What would be the amount of Regular Hours and Overtime based on Alberta and Federal for...
What would be the amount of Regular Hours and Overtime based on Alberta and Federal for the following 4 weeks. No averaging system is in place. May M T W T F S Su 8 8 8 8 8 4 9 7 8 9 10   10 10 10 10    8 8 8 8 8 8
C# (Thank you in advance) Create an Employee class with five fields: first name, last name,...
C# (Thank you in advance) Create an Employee class with five fields: first name, last name, workID, yearStartedWked, and initSalary. It includes constructor(s) and properties to initialize values for all fields. Create an interface, SalaryCalculate, class that includes two functions: first,CalcYearWorked() function, it takes one parameter (currentyear) and calculates the number of year the worker has been working. The second function, CalcCurSalary() function that calculates the current year salary. Create a Worker classes that is derived from Employee and SalaryCalculate...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using link list and perform the following operation on the list i)add employee details based on department ii)remove employee details iv)count the number of employee in each department
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT