DBS 201 Assignment Due: Wednesday, August 12, 2009 10% of your Final Mark Physical Database Design and Implementation There are 3 main objectives to this assignment: 1. To create the physical schema (data dictionary) for the provided tables 2. To implement this physical schema in a DB2 environment and insert appropriate data 3. To manipulate the data as directed This assignment may be done in groups of 2 or 3. Individual assignments are strongly discouraged . Submissions done by a single person will receive a 20% penalty. Each assignment must be accompanied by a Student Assignment Submission page.( 1 sheet per group assignment) Student Assignment Submission Form I/we declare that the attached assignment is my/our own work in accordance with the Seneca Academic Policy. No part of this assignment has been copied manually or electronically from any other source (including web sites) or distributed to other students. Name(s) Student ID(s) Signature 1 2_____________________________________________________________________ 3_____________________________________________________________________ Plagiarism and Cheating (Refer to section 8.7, page 6 of Seneca’s Academic Policy) (or visit: http://cs.senecac.on.ca/bullets/cheating.html) Your task is to create a database for Seneca’s Shear Salon. The narrative below explains the manner in which this business is conducted: Seneca's Shear Salon sells beauty products and provides hairdressing and other services on a drop-in basis to customers who may be students, faculty, staff or the public. Seneca’s Esthetics students provide the services and are supervised by faculty members. A schedule is prepared each month identifying the faculty members and students scheduled to work each day. Each day one faculty member is normally scheduled to supervise students in the morning session and a different faculty member is scheduled to supervise the afternoon session. Each day 5 students are scheduled to work in the salon. Each student is assigned to a station: either the cash register, hair treatments, shampoo, massage or esthetics. Students are assigned to work at different stations during the schedule. The services provided include: hair cuts, perms, highlights, manicures, pedicures and massage. A list of services offered and charges is posted by the cash register. A customer may have one or more services performed during their visit. A customer may also purchase products sold at the salon. Information about products sold is posted by the cash register. After a customer is finished the student assigned to the cash register prepares an invoice listing all services performed and the student who performed them as well as any products purchased. Payment is accepted only in cash. Requirements: 1. Prepare the physical database design (aka: data dictionary) that will guide you in the implementation of your database. The eight (8) tables required for this task are given below Table Name Attributes SERVICE [ServiceCode, ServiceDesc, StationCode, Charge, Duration] INVOICE [Invoice#, ClientName, InvDate, HairEmpNo, MassEmpNo, EsthEmpNo, ServiceSubTotal, ProductSubTotal, PSTamt, GSTamt, InvoiceTotal, PrepEmpNo] INVOICED_SERVICE [Invoice#, ServiceCode] PRODUCT [Product#, ProductName, Size, UnitofMeasure, UnitCost, Supplier, ReorderPt, ReorderQty, Qtyon Hand] INVOICED_PRODUCT [Invoice#, Product#, ProductQty, ProductCharge] EMPLOYEE Emp#, EmpFName, EmpLName, HPhone, Cphone, Stud#, ProgYr, SemHrs] PROG_YR [ProgYr, PayRate] STATION [StationCode, StationDesc.] You will need one form for each table. (see below) -(i.e., 8 forms in all) You may copy the form below to complete your data dictionary. TABLE NAME: ______________________________ Column Name Data Type Length PK FK NOT Unique Check NULL 2a. Create the tables in the DB2 environment. Choose the account of one member of your group in which the work will be done. Create a collection called Shearxxx (xxx stands for the account number; i.e., (B33) Create the tables including keys and constraints. The column names that you use in the creation of this database should correspond to the names listed in the data dictionary. Note, at this point, you should be working in the SQL environment and not in the *SYS environment. If you have not already done so, use <Shift F1> to change session attributes. Coding will read as Shear.xxx 2b. Insert data into your created tables. The data that you will use comes from the userviews that form the Appendix of this assignment. Default . 3. Data Manipulation. With respect to the data stored in your tables, create 2 views. a) The first view is called UnderanHour and should show the service description, charge and time estimate for services that take less than 60 minutes. b) The second view is called INV1423 and should allow the client to view the details of his November 1, 2001 visit. c) Update the product table. Due to a company merger, the supplier Salon Products Ltd.has undergone a name change and will now be known as Beauty Salon Products. Hand In Requirements The following items must be included when you hand in your assignment: 1.The Student Submission Cover Sheet 2.the data dictionary for the eight tables that make up your database 3.print-outs of the 8 tables, including the inserted data 4.print-outs of the 2 views 5.print-out of the updated Product table 6.printed syntax for the creation of the Employee table and the Invoice table (if you used alter commands to add constraints or keys, include those as well) 7.printed syntax for the creation of the two views Appendix USERVIEW 1: SENECA SHEAR SALON SERVICE CHARGE LIST SERVICE CODE 10 11 12 13 20 21 23 24 SERVICE DESCRIPTION STATION CODE H H H H E E M M Cut Cut and Blow-Dry Perm Highlights Manicure Pedicure Hand and Foot Massage Back Massage CHARGE TIME ESTIMATE (min) 10.00 15.00 30.00 25.00 10.00 15.00 15.00 20.00 30 45 60 60 30 30 30 45 USERVIEW 2 (2 examples): SENECA SHEAR SALON INVOICE DATE: Oct 31 2001 CLIENT: Paul HAIR: Phil, 126 ESTHETICS: SERVICE 10 – Cut SERVICE SUBTOTAL PRODUCT# AND NAME QTY 144 Raymond Styling Gel 2 235 Style Volumizing Shampoo 1 PRODUCT SUBTOTAL: INVOICE SUBTOTAL: PST: GST: INVOICE TOTAL: PREPARED BY: INVOICE#: 1423 MASSAGE: CHARGE 10.00 10.00 CHARGE 12.00 8.00 20.00 30.00 2.40 2.10 34.50 Paula Corelli, #121 SENECA SHEAR SALON INVOICE DATE: Nov 1, 2001 CLIENT: Mary INVOICE#: 1425 HAIR: Cindy, 120 ESTHETICS: Susan, 125 MASSAGE: SERVICE CHARGE 12 - Perm 30.00 20 - Manicure 10.00 21 - Pedicure 15.00 SERVICE SUBTOTAL PRODUCT# AND NAME QTY CHARGE 234 Style Volumizing Shampoo 1 5.00 PRODUCT SUBTOTAL: INVOICE SUBTOTAL: PST: GST: INVOICE TOTAL: PREPARED BY: 55.00 5.00 60.00 4.80 4.20 69.00 Paul Huang, 123 USERVIEW 3: SENECA SHEAR SALON INVENTORY REPORT PRODUCT # 100 PRODUCT NAME Shampoo Towel SIZE 122 Superior Nail Top Coat Raymond Styling Gel Raymond Styling Gel Style Volumizing Shampoo Style Volumizing Shampoo Raymond Round Brush 10 ml 1.00 100 ml 200 ml 300 ml 500 ml 6 inch 4.00 144 145 234 235 250 UNIT COST 3.00 5.00 3.00 5.00 1.99 SUPPLIER Discount Esthetics Discount Esthetics House of Style Ltd House of Style Ltd Salon Products Ltd Salon Products Ltd House of Style Ltd REORDER POINT 20 REORDER QUANTITY 30 QUANTITY ON HAND 35 5 20 17 10 20 12 15 30 10 10 20 5 20 40 5 5 20 2 USERVIEW 4: SENECA SHEAR SALON STUDENT EMPLOYEE REPORT EMP # 120 NAME 121 Paula Corelli 122 Amy Smith 123 Paul Huang 124 Maria Wong 125 Susan Wong 126 Phil Ramirez Cindy Lee HOME PHONE 905-3381234 416-4584562 905-3381234 416-9324533 905-3455366 905-3455366 416-4356599 CELL PHONE 416-3324354 905-6543552 STUDENT# 0219032002 PROG YEAR 3 PAY RATE 10.00 SEMESTER HOURS 22 0325443001 2 8.00 20 034111991 3 10.00 20 054222991 3 10.00 21 043524532 3 10.00 19 046543534 2 8.00 22 032543555 2 8.00 20