Practice Problem 12.3 Lone Star

PRACTICE PROBLEM 12.3 LONESTAR CONSTRUCTION COMPANY
The Lone Star Construction Company located in Dallas, Texas performs contract work for various
companies in the surrounding area. Each worksite has a different employee pay scale based on many
factors, such as the bid, the profit margin, and whether or not this is a union job. You have created a
database that will calculate the gross pay for each employee. The database tables are as follows:
Employees: This table lists the name, address, and hire date of all the company’s employees. It also
includes a yes/no field indicating whether or not the employee is eligible for benefits. Each employee is
identified by a unique EmployeeID.
Jobs: This table lists the hourly wages for each job site. Each job site is identified by a unique JobID.
Timesheets: This table lists the number of hours the employee worked each day, and the respective job
site.
** Join on is the field joined to create a relationship between tables, and can also be called the Foreign Key on the QBE grid.
***Join type will be discussed in the next chapter.
1. Create a relationship diagram for the Lone Star database
Identify the primary keys and foreign keys
Establish the relationships between each table
2. Has referential data integrity been violated between any of the tables? If so, name the orphans.
** Join on is the field joined to create a relationship between tables, and can also be called the Foreign Key on the QBE grid.
***Join type will be discussed in the next chapter.
3. Write a query to summarize by job site, the total employee wages paid to date. List the job site,
hourly pay, total man hours, and total employee cost.
Query Name: __________________
Tables Required: ___________________
**Join On: ______________________
***Join Type: Inner
Field
Table
Total
Sort
Show
Criteria
OR
OR
Additional Room for Expressions if needed:
4. Write a query to summarize by employee, the number of hours to date they have worked at the San
Antonio Airport job site. List the Employee ID, last name, first name, and total hours worked. Sort
the list alphabetically by last name, and then by first name.
Query Name: __________________
Tables Required: ___________________
**Join On: ______________________
***Join Type: Inner
Field
Table
Total
Sort
Show
Criteria
OR
OR
Additional Room for Expressions if needed:
** Join on is the field joined to create a relationship between tables, and can also be called the Foreign Key on the QBE grid.
***Join type will be discussed in the next chapter.
5. Write a query to calculate the average, maximum, and minimum number of hours spent at each job
site. List the jobsite, the average, maximum, and minimum number of hours.
Query Name: __________________
Tables Required: ___________________
**Join On: ______________________
***Join Type: Inner
Field
Table
Total
Sort
Show
Criteria
OR
OR
Additional Room for Expressions if needed:
** Join on is the field joined to create a relationship between tables, and can also be called the Foreign Key on the QBE grid.
***Join type will be discussed in the next chapter.
6. Create a pay sheet for the month of January 2013. For each employee, list his or her Employee ID,
last name, the number of days worked that month, the total number of hours worked, and their
total gross pay for January 2013.
Query Name: __________________
Tables Required: ___________________
**Join On: ______________________
***Join Type: Inner
Field
Table
Total
Sort
Show
Criteria
OR
OR
Additional Room for Expressions if needed:
7. Using the previous query as input and any other tables needed, write a query to list the employee id and
last name of employees who worked more than 30 hours in January 2013 and were benefits eligible.
Query Name: __________________
Tables Required: ___________________
**Join On: ______________________
***Join Type: Inner
Field
Table
Total
Sort
Show
Criteria
OR
OR
Additional Room for Expressions if needed:
** Join on is the field joined to create a relationship between tables, and can also be called the Foreign Key on the QBE grid.
***Join type will be discussed in the next chapter.