Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Principles Autumn 2007 High Distinction Assignment REBEL Sport Online Author: Joseph Diver.

Similar presentations


Presentation on theme: "Database Principles Autumn 2007 High Distinction Assignment REBEL Sport Online Author: Joseph Diver."— Presentation transcript:

1 Database Principles Autumn 2007 High Distinction Assignment REBEL Sport Online Author: Joseph Diver

2 Introduction Purpose: To maintain ordering of products based on current stock levels and processing of current orders This database is also built upon the AS400 system which is required for stock levelling, delivery&installations and so on

3 ERD

4 Single-To-Many Relationship Rebel_Suppliers SupplierID CompanyName Address OfficePhoneNo FaxNo Comments Rebel_PurchaseOrders PurchaseOrderID SupplierID* DateOfCreation DueDatePurchaseOrderIDSupplierID1245950200682 1245950300682 1245950400546 1245950500125 1245950600125 1245950700408

5 Many-To-Many Relationship Rebel_Orders OrderID SKU* StaffID* DelInstNo* Quantity Date_Created DueDate AusPostRef Rebel_Customers CustID FirstName LastName UnitNo StreetNo StreetName StreetType Suburb PostCode HomePhone WorkPhone MobilePhone Email Rebel_CustOrders CustID* OrderID*CustIDOrderID2563247901458945685 2563247911458945686 2563247911458945687 2563247921458945689 2563247921458945690 2563247941458945691 2563247951458945692

6 Select Query This query selects the items which are not on order

7 Natural Join This query join the purchase order table with the suppliers table to find orders before 15 th of August

8 Cross Product This query selects the orders which have DeliveryInstallation numbers attached to them

9 Group By This query outputs the number of delivery or installations allocated to each supplier

10 Sub-Query This query selects the products with the maximum price but still have a cost under $200

11 Check Statement CONSTRAINT PK_StockLevel PRIMARY KEY (SKU, StoreID), CONSTRAINT FK_SKU FOREIGN KEY (SKU) REFERENCES Rebel_Items ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT FK_StoreID FOREIGN KEY (StoreID) REFERENCES Rebel_Stores ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT SKU_Length CHECK (length(SKU) = 7), CONSTRAINT StoreID_Length CHECK (length(StoreID) = 5), CONSTRAINT Level_Valid CHECK (Level >= 0), CONSTRAINT OnLayby_Valid CHECK (OnLayby >= 0), CONSTRAINT OnOrder_Valid CHECK (OnOrder >= 0), CONSTRAINT NetOnHand_Valid CHECK (NetOnHand = (OnHand - (InTransfer + OnLayby))), CONSTRAINT ValidOrdering CHECK (OnOrder <= (Level - NetOnHand))

12 Action Statements CONSTRAINT FK_DIStaff FOREIGN KEY (StaffID) REFERENCES Rebel_Employees ON DELETE RESTRICT -- DnI's require a staff number attached to them ON UPDATE CASCADE, CONSTRAINT FK_DISupplier FOREIGN KEY (SupplierID) REFERENCES Rebel_Suppliers ON DELETE RESTRICT -- If the Supplier disappears, the customer would be left hanging ON UPDATE CASCADE,


Download ppt "Database Principles Autumn 2007 High Distinction Assignment REBEL Sport Online Author: Joseph Diver."

Similar presentations


Ads by Google