HW2 (100 PTS) CHAPTER 3 Use the database shown in Figure P3.10 to solve the problems (1-3) below. Note that the database is composed of four tables that reflect these relationships: An EMPLOYEE has only one JOB_CODE, but a JOB_CODE can be held by many EMPLOYEEs. An EMPLOYEE can participate in many PLANs, and any PLAN can be assigned to many EMPLOYEEs. Note also that the M:N relationship has been broken down into two 1:M relationships for which the BENEFIT table serves as the composite or bridge entity. FIGURE P3.10 The Ch03_BeneCo Database Tables 1 (4 pts) Do the tables exhibit entity integrity? Answer yes or no and then explain your answer. 2 (4 pts) Do the tables exhibit referential integrity? Answer yes or no and then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key. 3 (4 pts) Create the ERD to show the relationships among EMPLOYEE, BENEFIT, JOB, and PLAN. 1 Chapter 4 4 a. b. c. d. e. f. g. h. (40 pts) Using the Crow’s Foot methodology, create an ERD that can be implemented for a medical clinic, using at least the following business rules: A patient can make many appointments with one or more doctors in the clinic, and a doctor can accept appointments with many patients. However, each appointment is made with only one doctor and one patient. Emergency cases do not require an appointment. However, for appointment management purposes, an emergency is entered in the appointment book as “unscheduled.” If kept, an appointment yields a visit with the doctor specified in the appointment. The visit yields a diagnosis and, when appropriate, treatment. With each visit, the patient’s records are updated to provide a medical history Each patient visit creates a bill. Each patient visit is billed by one doctor, and each doctor can bill many patients. Each bill must be paid. However, a bill may be paid in many installments, and a payment may cover more than one bill. A patient may pay the bill directly, or the bill may be the basis for a claim submitted to an insurance company. If the bill is paid by an insurance company, the deductible is submitted to the patient for payment. Chapter. 5 5 (12 pts) Given the following business scenario, create a Crow’s Foot ERD using a specialization hierarchy if appropriate. Granite Sales Company keeps information on employees and the departments that they work in. For each department, the department name, internal mail box number, and office phone extension are kept. A department can have many assigned employees, and each employee is assigned to only one department. Employees can be salaried employees, hourly employees, or contract employees. All employees are assigned an employee number. This is kept along with the employee’s name and address. For hourly employees, hourly wage and target weekly work hours are stored (e.g. the company may target 40 hours/week for some, 32 hours/week for others, and 20 hours/week for others). Some salaried employees are salespeople that can earn a commission in addition to their base salary. For all salaried employees, the yearly salary amount is recorded in the system. For salespeople, their commission percentage on sales and commission percentage on profit are stored in the system. For example, John is a salesperson with a base salary of $50,000 per year plus 2-percent commission on the sales price for all sales he makes plus another 5 percent of the profit on each of those sales. For contract employees, the beginning date and end dates of their contract are stored along with the billing rate for their hours. 2 6 (18 pts) 7 (6 pts) Devise a relationship set (for a binary relationship type involving A and B, as above) for which the correct answer is ( N:1, total, partial ). 8 (12 pts) The set of possible answers for each of parts (a) through (f ) of problem 1 has sixteen elements (4 · 2 · 2, corresponding to the product of the number of choices for each component). Five of the sixteen are impossible, given our choice of entity sets, namely {a1,a2,a3} for A and {b1, b2, b3, b4} for B. Identify two of the impossible answers and tell why it is impossible. 3