DBS201 Assignment 1

advertisement
DBS201 Assignment 1 - (10 Marks)
Physical Design and Implementation of Seneca Mechanical Lab.
Due Tuesday Feb. 24 (Check with your instructor about submission)
-----------------------------------------------------------------------------------------------------------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.
----------------------------------------------------------------------------------------------------------------------------- Your group must consist of 2 or 3 people. Submissions done by a single person will
receive a 20% penalty.
 You must hand in the Student Assignment Submission Form (below) with your assignment (one
per group).
 Students are encouraged to hand in the assignment earlier than the cutoff time. It will be strictly
enforced. All assignments received after that time will be subject to a late penalty
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
1)
Name:
Student ID:
------------------------------------------------------------------------------Work Done:
------------------------------------------------------------------------------Signature:
-------------------------------------------------------------------------------
2)
Name:
Student ID:
------------------------------------------------------------------------------Work Done:
------------------------------------------------------------------------------Signature:
-------------------------------------------------------------------------------
3)
Name:
Student ID:
------------------------------------------------------------------------------Work Done:
------------------------------------------------------------------------------Signature:
-------------------------------------------------------------------------------
ZEUS ACCOUNT: _____________________________
Assign 1
1/4
Here is some information about SENECA MECHANICAL LAB:
SENECA MECHANICAL LAB provides tools to students studying in the mechanical
engineering department. You are asked to design an Inventory Management System for
the lab to keep track of the inventory on hand and to track the use of items by students.
Students can login on with their valid credentials and search for the items they want
to rent, The administrator and lab technicians are provided with the additional
views in which they are allowed to issue an item to the student and to add, modify or
delete the entities in the system.
Inventory management module contains all the features like add, modify and delete
an item, along with item search based on any criteria. The system should also
facilitate the purchase orders; the administrator, lab technician or faculty is allowed
to place the orders from the inventory system by a secure login. The placed orders
can be viewed in the order search page, along with the order status.
Note there is a One-to –Many relationship between STUDENT and ITEM. One student
can borrow more than one item.
The weekly usage report can be printed for all items, which shows the
items borrowed by students during last week.
SENECA MECHANICAL LAB
Supplier Report
Supplier
Number
46
52
83
103
First Name
LastName
Address
Phone
Laurie
Ronald
Tom
Jeanne
Wells
MacDonn
Duley
Jeanne
112 Apple Rd, Toronto
1 Big Mac Rd, Toronto
3 Hanghead Dr. Markham
2 Youngalive St. Toronto
(416) 289- 4417
(800) 448- 9000
(416) 229- 4104
(416) 664- 3121
SENECA MECHANICAL LAB
Weekly Usage Report
Assign 1
Program
EEng
Student Name
Oliv Gardenor
MEng
Joe Shoelly
CEng
Walter Chan
Mathematics
Peter Wan
CET
Alex
CPA
Sherly
EEng
Walter Chan
Item#
Date Issue
Date Return
Qty
P100
2014-02-17
2014-02-19
2
CMT2
2014-02-17
2014-02-21
5
A100
2014-02-18
2014-02-20
8
A137
2014-02-18
2014-02-18
10
P100
20141-02-18
2014-02-22
4
STL10
2014-02-20
2014-02-21
3
ST22
2014-02-19
2014-02-21
1
2/4
Here are the seven tables required to support these two reports.
Table Name
Attributes
1. CATEGORY
[Cat#(PK) , Cat_Type] :Cat_Type should be unique
2. ITEM
[Item#(PK),Cat#(FK),Container_code, Date_Purchased,
Qty, Status]
Check Constraint: Date_Purchased should be earlier than
sysdate . – NOT needed for this Assignment
Qty should be > 0
3. PROGRAM
[Progam#(PK), Program_Cordinator]
Program_Cordinator should be provided and be unique
4. STUDENT
[Student#(PK), Program#(FK),Student_Name, ,Password,
Phone#, Address]
5. STUDENT_ITEM
[Student#(PK)(FK), Item#(PK)(FK),
Date_Issued, Date_Return]
Check Constraint: Date_Return > Date_Issued
6. SUPPLIER
[Supp#(PK), SLName, SFName, SuppAddress,
Supp_Phone, Supp_LicenseNumber]
7. SUPPLIER_ITEM
[Supp#(PK)(FK),Item#(PK)(FK),price]
Check Constraint: price > 0
Note: On the SENECA Screen using a SELECT, a date will appear as mm/dd/yy
whereas on the Navigator “Run an SQL Script” the date will appear as yyyy-mm-dd
Assign 1
3/4
Part 1: Hand-in the Physical Design form. Complete one form for each table.
TABLE NAME: ______________________________
Column
Data
Name………………. Type
Length PK FK
NOT Unique Check
NULL
Default
 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. Screen shots may require two
shots in order to display the left-hand side and the right-hand side of the report.
 You may use Open Office WRITER or WORD or some other similar program.
Part 2: Hand-in the SQL statements used to create the 7 Tables:
Choose a group member i-Series account and create a collection named
WKINVENTORYxxx (where xxx is the last 3 characters of your userid). Create the
seven tables defined above. Column names must be the same as those shown in the data
dictionary. Use proper formatting(indenting). Secure the collection so the public does not
have access. Allow schema access to Your Instructor (that will be explained in your
class) and the profiles in the group.
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.
 While inventing the data make sure all the required SELECT statements should
return at least one row.
Part 4: Provide Screen Shots showing the contents for each Table (all Rows)
Assign 1
4/4
Part 5: Provide the SQL statements to Create 2 “Views”
i)
WK_ITEMINFO which will contain all the attributes shown on the Weekly usage
report.
ii)
WK_SUPPKIERITEM which will show the list of all items supplied by a supplier
living in Toronto with price less than 100.
Part 6 : For BOTH Views, provide screen shots of SELECT * FROM viewname
Part 7: Provide the Required SQL statement.
The lab manager asks you to print a list of all items that needs to reorder. Items with quantity less
than 5 are short on hand. Provide a list of all such items along with the supplier name supplying
them at min price so an order can be generated. 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
5/4
Download