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 ---- --------------- --------- --------- --------- --------- --------- -- -- ---- 1111 Good Night Moon 24 30 40 8 12.99 BK BY X100 1212 Heidi 12 25 25 10 14.99 BK CH X112 1234 Adven Reddy Fox 5 0 10 9 14.75 BK CH X100 2121 Teddy Bear 5 20 40 15 19.95 TY CH X115 2222 Building Blocks 4 0 15 48 51.99 TY CH Z200 2345 Doll House 2 5 10 45 55.98 TY CH Z212 3333 Basketball 24 25 50 14 17.99 SP BK Y200 3456 Net/Hoop 12 0 25 25 27.95 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 --------- -------------- ------------- 10 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 --------- --------- ---- 11111 Susan Ash 123 Elm St Fall River MA 02720 0 0 1000 05-NOV-97 1111 12121 Richard Davis 24 West St Fall River MA 02720 0 100 500 10-DEC-98 1212 12345 Linda Anderson 45 Main St A#3 Seekonk MA 02771 100 0 500 14-OCT-98 1111

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 ---- -------------------- --------- 1111 John Smith.08 1212 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 ------ ----- --------- 000001 11111 10-JUN-99 000002 12121 10-JUN-99 000003 12345 10-JUN-99 000004 11111 08-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 ------ ---- --------- 000001 1212 1 000001 2121 1 000001 2345 1 000002 1111 3 000002 3333 1 000003 3333 2 000003 3456 1 000004 1212 3 000004 1234 2 9 rows selected.


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

Similar presentations


Ads by Google