DBS201 Assignment Part 2: Normalization of Userviews

Total Page:16

File Type:pdf, Size:1020Kb

DBS201 Assignment Part 2: Normalization of Userviews

DBS201 Assignment 1 - (7 Marks)

Physical Design and Implementation of Marlboro Homes Inc.

Due Date: Monday Oct 14, 2013 Midnight

------In this assignment you will:

1. Create Physical Schemas. 2. Create a DB2 relational database. 3. Create and use Tables 4. Insert data into Tables. 5. Create and use Views.

------Submission Requirements:

This assignment must be handed-in via email. The subject line must be DBS201-A1-LastName-FirstName. where FirstName-LastName is the name of the person on whose account the database has been created. Here is an example of the title line: DBS201-A1-JOHN-SMITH. All group members names must appear on the assignment submission form at: Assignment Submission Form which you must submit with your solution.

This assignment is to be done in groups of 2 or 3 students. Students are expected to form their own groups. A group may have students from more than one section. Submissions done by a single student will incur a penalty of 20%.

Here is some information about MARLBORO HOMES INC:

An engineering firm named MARLBORO HOMES INC provides design and build services to government and private organizations. The weekly Sales Report and the Customer List Report are shown below. There are six tables required to support these two reports.

Note that there is a Many-to-Many relationship between INVOICE and EQUIPMENT. One invoice can have more than one piece of equipment and that one particular piece of equipment can appear on more than one invoice. For example: Invoice number M-44720 has Equipment numbers P100 and CMT22. Also note that Equipment number P100 appears on Invoice M-44720 and M-44721.

The Weekly Sales Report shows the Customer number which relates to a CUSTOMER table with attributes that are shown on the Customer Report. Any particular GST_LicenseNumber can occur only once in the CUSTOMER table as every customer must have a different GST_LicenseNumber. The only attributes that can be skipped are CustAddress and CustPhone and InvoiceDate. If InvoiceDate is skipped, the system will insert today’s date. The system inserts blanks into SalesPersonName when skipped. GST_LicenseNumber must be greater than or equal to 100000000 and less than 999999999.

Assign. 1 1 of 3 MARLBORO HOMES INC

Weekly Sales Report

Equip Type Equip Equipment Invoice Invoice Sales-Person Cust Type Description Num Description Charge Qty Num. Date No

OFF Office Copier P100 Kodac $420.00 2 M-44720 2013-09-17 23-Oliv Gardenor 103 Photocopier MIX Concrete Mix CMT2 Concrete Mixer $4000.00 20 M-44720 2013-09-17 23-Oliv Gardenor 103 TRU Wood Trusses A100 50’ x 16’ Roofing $1200.00 48 M-44721 2013-09-18 13-Walter Chan 83 FRM Framing A137 2 x 4 x 8 Poplar $7500.00 1000 M-44721 2013-09-18 13-Walter Chan 83 OFF Office Copier P100 Kodac $840.00 4 M-44721 2013-09-18 13-Walter Chan 83 Photocopier STF Steel Framing STL10 Front Steel Loader $1500.00 3 M-44721 2013-09-18 13-Walter Chan 83 MIX Concrete Mix ST22 Stone Crusher $950.00 1 M-44722 2013-09-18 23-Oliv Gardenor 46 FLD Front Loader FL660 Front Loading $450 1 M-44722 2013-09-18 23-Oliv Gardenor 46 Device CRA Overhead CRA- 120’ Overhead $9000 3 M-44723 2013-09-18 20-Joe Shoelly 52 Lift 11 Crane

MARLBORO HOMES INC Customer Report

Customer First Name LastName Address Phone Number 46 Laurie Wells 112 Apple Rd, Toronto (416) 289- 4417 52 Ronald MacDonn 1 Big Mac Rd, Toronto (800) 448- 9000 83 Tom Duley 3 Hanghead Dr. Markham (416) 229- 4104 103 Jeanne Jeanne 2 Youngalive St. Toronto (416) 664- 3121

Here are the six tables required to support these two reports.

Table Name Attributes

1. INVOICE [Inv#(PK) , InvoiceDate, SalesPerson#(FK), Cust#(FK)]

2. INVOICE_EQUIPMENT [Inv#(PK)(FK), Eqp#(PK)(FK), Qty, Charge]

3. EQUIPTYPE [EqpType#(PK), EqpTypeDesc]

4. SALESPERSON [SalesPerson#(PK), SalesPersonName]

5. EQUIPMENT [Eqp#(PK), EqpDesc, EqpType#(FK)]

6. CUSTOMER [Cust#(PK), CLName, CFName, CustAddress, CustPhone, GST_LicenseNumber]

Assign. 1 2 of 3 Part 1: Hand-in the Physical Design form. Complete one form for each table.

TABLE NAME: ______

Column Data LengthPK FK NOT Unique Check Default Name………………. Type NULL

For all questions from Part 2 to 8 perform the SQL commands on a group member’s ZEUS account. Hand-in the formatted SQL command which was used. Use screen shots to display the results of each step. Screen shots may require two shots in order to display the left-hand side and the right-hand side of a report. You may use Open Office WRITER or WORD.

Part 2: Hand-in the SQL statements used to create the 6 Tables: Choose a group member i-Series account and create a collection named SALESxxx (where xxx is the last 3 characters of your userid). Create the six tables defined above. Column names must be the same as those shown in the data dictionary. Use proper formatting(indenting).

Part 3: Hand-in the Insert statements used to insert three Rows for each Table You should use data from the two reports and you may also need to invent some data.

Part 4: Provide Screen Shots showing the contents for each Table (all Rows)

Part 5: Provide the SQL statements to Create 2 “Views” i) SALESINFO which will contain all the attributes shown on the Weekly Sales Report for all sales. ii) SALESGT1000 which will contain the all the columns in the Weekly Sales Report but includes only rows that have a Charge greater than 1000 dollars . Use proper formatting(indenting).

Part 6 : For BOTH Views., provide screen shots of SELECT * FROM viewname

Part 7: Provide the Required SQL statement. Your boss asks you to print out a report of sales for Wednesday Sept 18th similar to the Weekly Sales Report but without the EquipmentType column. The report should include all sales above $750. The report should be sorted by Invoice Number then Equipment Number. You must use one of the two views created in Part 3 to meet this requirement. Write the SQL statement that you will use. Use proper formatting(indenting). Part 8 : Run the SQL statement of Part 7 and provide a screen shot(s) of the result.

Assign. 1 3 of 3

Recommended publications