Presentation is loading. Please wait.

Presentation is loading. Please wait.

Order Entry System Please use speaker notes for additional information!

Similar presentations


Presentation on theme: "Order Entry System Please use speaker notes for additional information!"— Presentation transcript:

1 Order Entry System Please use speaker notes for additional information!

2 Product Data: Item Number Item Name On Hand On Order Reorder Point Cost Price Department Number Department Name Department Manager Item Class Warehouse Location Customer Data: Customer Number Customer Name Street Address City State Zip Past Due Current Due Credit Limit Date First Bought Sales Representative Number Sales Representative Name Commission Rate Order Data: Customer Placing Order Order Date Item Number Ordered (allow multiple) Number Ordered of Item

3 Product Data: Item Number Item Name On Hand On Order Reorder Point Cost Price Department Number Department Name Department Manager Item Class Warehouse Location I will use the product data to create a product or inventory table. This will contain all of the information about the products carried in the inventory. Each product will be assigned a unique identification number (Item Number) which I can use as the primary key. The only problem that I see relates to Department. Department Name and Department Manager relate directly to the Department Number. Department Number is therefore the determinant. I cannot carry Department Name and Department Manager in the table or I will break the rules of normalization. Therefore I will create a separate Department Table that will be linked to the Inventory Table by Department Number. The rest of the data shown under Product Data directly relates to the Item and the Item Number which I have designated as the primary key.

4 Product Data: Item Number Item Name On Hand On Order Reorder Point Cost Price Department Number Department Name Department Manager Item Class Warehouse Location Item Item On On Reorder Cost Price Department Department Department Item Warehouse Number Name Hand Order Point Number Name Manager Class Location Dependency Chart

5 Product Data: Item Number Item Name On Hand On Order Reorder Point Cost Price Department Number Department Name Department Manager Item Class Warehouse Location Inventory Table Itemno primary key ItemName OnHand OnOrder ReOrdPt Cost Price Dept foreign key ItemClass Location Department Table Dept primary key DeptName Manager

6 Customer Data: Customer Number Customer Name Street Address City State Zip Past Due Current Due Credit Limit Date First Bought Sales Representative Number Sales Representative Name Commission Rate The data about the customer will go onto a Customer Table with the Customer Number as the primary key. There are no other candidate keys. Customer Name has the possibility of being duplicated so it is not a valid candidate key. All of the data listed here directly relates to the Customer Number except the Sales Representative Name and the Commission Rate. These relate to the Sales Representative Number which is therefore the determinant. I need to pull the information about the Sales Representative out and put it in a separate table or I will break the rules of 3NF.

7 Customer Data: Customer Number Customer Name Street Address City State Zip Past Due Current Due Credit Limit Date First Bought Sales Representative Number Sales Representative Name Commission Rate Cust Cust Street City State Cost Zip Past Current Date SalesRep SalesRep Commission Number Name Adr Due Due First Number Name Dependency Chart

8 Customer Data: Customer Number Customer Name Street Address City State Zip Past Due Current Due Credit Limit Date First Bought Sales Representative Number Sales Representative Name Commission Rate Customer Table Custid primary key CustName StAdr City State Zip PastDue CurrDue CrLimit DateFst SlsRep foreign key SalesRep Table SlsRep primary key SalesName CommRate

9 Order Data: Customer Placing Order Order Date Item Number Ordered (allow multiple) Number Ordered of Item I have several problems with the Order Data. First, there is no field that can serve as the identification number. In this situation it is a good idea to make my own candidate key which I will use as the primary key. I have decided to assign an Order Number which would be assigned by the system when the order is placed. I will set it up so the system will keep track of the order number and assign the next available order number to a new order. Second, Item Number Ordered allows for multiple. This means I would break the rules of 1NF and have repeating groups. I have also noticed that the Number Ordered of Item must be multiple as well to allow the customer to order a different number for ech item being ordered. Order Data: Order Number Customer Placing Order Order Date Item Number Ordered (allow multiple) Number Ordered of Item

10 Order Data: Order Number Customer Placing Order Order Date Item Number Ordered (allow multiple) Number Ordered of Item OrderHeader Table OrdNo primary key CustId foreign key OrdDate OrderLine Table OrdNo foreign key primary ItemNo foreign key key NumOrd In the OrderLine Table, I have established that the primary key is made up of two fields: the OrdNo and the ItemNo. If OrdNo alone was sufficient for the key, I would not have had to make the OrderLine Table, I could have simply carried the one item on the OrderHeader Table. Combining OrdNo with ItemNo gives a unique key assuming that a customer only orders an item once during an order. OrdNo is not only part of the primary key, it is also a foreign key linking back to the OrderHeader Table. It should also be noted that I have met the requirements of 2NF because all of the data in the OrderLine Table relates to the entire key. I do not have any non-key attributes that are dependent on only a part of the primary key.

11 Order Data: Order Number Customer Placing Order Order Date Item Number Ordered (allow multiple) Number Ordered of Item OrderHeader Table OrdNo primary key CustId foreign key OrdDate OrderLine Table OrdNo foreign key primary ItemNo foreign key key LineNo NumOrd Adding the LineNo column allows the customer to order an ItemNo twice in the order.

12 Order Data: Order Number Customer Placing Order Order Date Item Number Ordered (allow multiple) Number Ordered of Item OrderHeader Table OrdNo primary key CustId foreign key OrdDate OrderLine Table OrdNo foreign key primary ItemNo foreign key key NumOrd QuotedPrice Now I am adding QuotedPrice to the OrderLine Table. On first look, it might appear that QuotePrice only applies to ItemNo and therefore breaks the 2NF rule which says that every column must be dependent on the whole primary key. However, the QuotedPrice is the specific price quoted for this specific order so it applies to the whole primary key and the table remains normalized.

13 SQL> DESC inven; Name Null? Type ITEMNO NOT NULL VARCHAR2(4) ITEMNAME VARCHAR2(15) ONHAND NUMBER(5) ONORDER NUMBER(5) REORDPT NUMBER(5) COST NUMBER(6,2) PRICE NUMBER(6,2) DEPT CHAR(2) ITEMCLASS CHAR(2) LOCATION VARCHAR2(4) SQL> SELECT * FROM inven; ITEM ITEMNAME ONHAND ONORDER REORDPT COST PRICE DE IT LOCA Good Night Moon BK BY X Heidi BK CH X Adven Reddy Fox BK CH X Teddy Bear TY CH X Building Blocks TY CH Z Doll House TY CH Z Basketball SP BK Y Net/Hoop SP BK Y200 8 rows selected. Itemno primary key ItemName OnHand OnOrder ReOrdPt Cost Price Dept foreign key ItemClass Location Inventory Table

14 SQL> DESC dept; Name Null? Type DEPTNO NOT NULL NUMBER(2) DNAME VARCHAR2(14) LOC VARCHAR2(13) SQL> SELECT * FROM dept; DEPTNO DNAME LOC ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON Department Table Dept primary key DeptName Manager

15 Customer Table Custid primary key CustName StAdr City State Zip PastDue CurrDue CrLimit DateFst SlsRep foreign key SQL> DESC invcust; Name Null? Type CUSTID NOT NULL VARCHAR2(5) CUSTNAME VARCHAR2(20) STADR VARCHAR2(15) APT VARCHAR2(5) CITY VARCHAR2(15) STATE CHAR(2) ZIP VARCHAR2(5) PASTDUE NUMBER(6,2) CURRDUE NUMBER(6,2) CRLIMIT NUMBER(6,2) DATEFST DATE SLSREP VARCHAR2(4) SQL> SELECT * FROM invcust; CUSTI CUSTNAME STADR APT CITY ST ZIP PASTDUE CURRDUE CRLIMIT DATEFST SLSR Susan Ash 123 Elm St Fall River MA NOV Richard Davis 24 West St Fall River MA DEC Linda Anderson 45 Main St A#3 Seekonk MA OCT

16 SalesRep Table SlsRep primary key SalesName CommRate SQL> DESC salsrep; Name Null? Type SALSREP NOT NULL VARCHAR2(4) SALSNAME VARCHAR2(20) COMMRATE NUMBER(3,2) SQL> SELECT * FROM salsrep; SALS SALSNAME COMMRATE John Smith Joanne London.09

17 SQL> DESC orderz; Name Null? Type ORDNO NOT NULL VARCHAR2(6) CUSTID VARCHAR2(5) ORDATE DATE SQL> SELECT * FROM orderz; ORDNO CUSTI ORDATE JUN JUN JUN JUL-99 OrderHeader Table OrdNo primary key CustId foreign key OrdDate

18 OrderLine Table OrdNo foreign key primary ItemNo foreign key key NumOrd QuotedPrice SQL> DESC ordline; Name Null? Type ORDNO NOT NULL VARCHAR2(6) ITEMNO NOT NULL VARCHAR2(4) NUMORD NUMBER(3) SQL> SELECT * FROM ordline; ORDNO ITEM NUMORD rows selected.


Download ppt "Order Entry System Please use speaker notes for additional information!"

Similar presentations


Ads by Google