Assignment 2

Page 1

Assignment 2 (Due May 11, 2007) There are 4 questions in this assignment.

Question 1. This question is from the Textbook (the 10th edition or the International edition). This is an ERD and relational design question. It is the Marcia’s Dry Cleaning Project described in the first few chapters of the textbook. You are asked to complete the followings: • •

The questions in page 214. All tables/relations should be in either 3NF or BCNF. Page 262, Questions A, C, D, E, F, G, J, L.

Question 2.

Consider the following relations: Sailors (sid: integer, sname: string, rating: integer, age: real) Boats (bid: integer, bname: string, color: string) Reserves (sid: integer, bid:_integer, day: date) Write the following queries in SQL. No duplicates should be included in each of the answers. i. ii. iii. iv. v.

Find the names of sailors who have reserved boat number 103. Find the names of sailors who have not reserved a red boat. Find the names of sailors who reserved all boats. Find the names of sailors who have reserved at least one boat. Find the sids of sailors with age over 20 who have not reserved a red boat.


Question 3.

Draw a first level logical DFD for the following scenario describing the payroll activities of a local company. The Payroll system at Hong Fok Company is responsible for computing the net pay amount and issuing the pay cheques to Company’s employees. This system must interact with the Human Resources department (another system) to obtain information about the newly hired employees. For each new employee, he or she must complete the Personal Information Form (PIF) at the Human Resources (HR) department and HR forwards a copy of the form to the Payroll department. Mr. Tai, a staff in the Payroll Department, verifies the form, returns it to the employee if the form is incomplete and/or invalid. Mr. Tai uses the valid forms to update the Employee- Master file (this file belongs to the Payroll department.) The employees of Hong Fok Company can be either “permanent” or “temporary” workers. The records in the Employee-Master file have a field (employee-status field). This field will store “P ” for permanent employees and “T” for the temporary employees. To compute the employee’s net pay, the Payroll department must use the Employee- Master file, as well as the company’s Pay-Table and MPF-Table (both tables are updated by the HR department, but the Payroll department has “read only” access to them.) Employee’s net pay is computed using one of the following two methods: •

Permanent Employees: Gross pay is computed on the basis of the employee’s Pay-Category (read from company’s Employee-Master file), and the standard pay rate (read from the PayTable). MPF figures are calculated by looking up the MPF-Table. The employee’s net pay is computed by deducting the MPF amount from the gross pay. Temporary Employees: Gross pay for the temporary workers are computed on the basis of the employee’s Work-Category (read from the Employee-Master file), and the Work-Pay-Rate (read from the Payroll department’s Work-Pay chart). Note that the temporary employees are not subject to MPF deduction.

On the last Friday of each month, the Payroll Department must perform the following tasks: • • •

Compute the net pay figures for all employees, and update the Employee- Master file. Access the Employee-Master file and prepare a monthly Direct-Deposit slip for each employee and send the slips to banks. Each employee receives a copy of their deposit slip Access the Employee-Master file, and print the Payroll Report. This report is sent to the manager of the Payroll department and to the HR department.


Question 4.

The Kowloon Arts Gallery has been keeping all their sales related information in a spreadsheet. As the spreadsheet has grown in size, it has become almost useless for finding information. The ga llery owner wants to take the data from the spreadsheet and put it in a database of third normal forms. The spreadsheet records which Sales Associate sold which pieces of artwork (referred to as the Title in the spreadsheet). It also records the customer’s name and address, as well as artist information for when the gallery wants to order more from the Artists. The spreadsheet is also used for accounting purposes, and so records important Sales related information. The Kowloon Fine Arts Gallery has observed that no customer ever buys two of the same artwork (same Title) from the same artist and sales associate on the same day. You can assume that will continue to be the case. The gallery has also noticed that two different artists may use the same title for the two different artworks they produce. However, no single artist will ever use the same title twice. Some artworks are unique, and some are not. The Kowloon Fine Arts Gallery sells prints of an artwork, so it is possible for two different people to buy an artwork with the same Title from the same artist. It is also possible for a customer to buy an artwork of the same Title from the same artist! Note that it is assumed that if this happens, the customer will buy the second copy from another sales associate or will purchase the second copy at a later date. Sculptures can be copied (casts of the original) and paintings can be copied. Copies of paintings are generically known as prints, and can also be referred to using the method of copy: giclée (a French word), silk screen, or stenography are common methods. If an artist is no longer alive, then “deceased” is put into those columns of artist information. Some more information is listed below. •

Two customers may have the same name. You can distinguish between two identically named customers by looking at their addresses.

Two artists may have the same name. You can distinguish between two identically named artists by looking at their addresses. (Ignore the case of "deceased", above)

The tax is calculated from the selling price by using a fixed tax rate, used by a program (not visible to the database).

Each sales associate earns a commission rate based on his/her length of service. The length of service of sales associates is not stored in this database.

The cost of an artwork (the amount that the gallery pays to the artist) is negotiated between the artist and the gallery. Each copy of a given original costs the same; the cost of a copy is less than the cost of the original.

The selling price of an artwork (the amount paid by the customer) is fixed for each item.

In order to complete this normalization exercise, it is not necessary to add extra columns to provide unique IDs for any of the resulting tables. In the real world, you would probably do that for performance reasons, but it is not necessary in order to perform normalization.

Develop an XML schema in DTD for this database. Indicate the attributes of each element and relationship.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.