Você está na página 1de 3

Eric Sharer Section 002 11/22/2013 Business Case Scenario My case study is based on a Medicine Wholesaler purchasing medicine

from a Medicine Manufacturer. As you can see the MedicalWholesaler is a non-identifying relationship with both the MedManuf and the MedicineOrders because it is outside the MedManuf company which is concerned with all of the identifying relationships to bring the MedicalWholesaler its medicine products. The Type of medicine is represented in the subtype entities connected by a complete and disjoint constraint. These constraints allow the medicine to have to be one of the subtypes and only be one of the subtypes. These subtypes are linked to the supertype by using Medicine_Type which identifies if the medicine is a liquid, solid, or gas. The primary and Foreign keys for each of the subtypes are Medicine_ID with their individual Medicine_Type identifier. I am making the assumption that medicine can be in only one state of matter. Then you can learn the Unit Price and unit Cost of the Medicine to the MedicineManuf. Once we have identified the type of medicine and the unit costs the Medical wholesaler will make an order. Within the MedicineOrders table I have specified that the wholesaler and order Ids must be included and not null and that this figures out the total Order_Price and Order_Cost of the MedicalWholesalers order to the MedicineManuf. I needed to use an assosiative bridge table to link MedicineOrders and Shipping because they would have been a Many to Many relationship. In creating an associative table I have used the Primary Keys from MedicineOrders and Shipping to supply the Primary and Foreign Keys for MedicineOrderLine. The shipping table allows the MedicalWholesaler and MedicineManuf to track what truck and what date the Order was shipped on. This is important when tracking inventory for both Companies and Clients.

SQL Queries Explained REM 1: Subquery1 This subquery has three layers to it going through the MedicalWholesaler, MedicineManuf, and LiquidMedicine tables. It identifies the name of the wholesaler, their Wholesaler_ID, and State who purchased the LiquidMedicine with a Blueish-Green Color. REM 2: Subquery2 This subquery has three layers to it going through the MedicineOrders, MedicineOrderLine, and Shipping. It gives us the Wholesaler_ID, Order_Price, and Order_Cost of the order that was shipped on Truck 09 and on Ship_Date 25-Jun-2013. REM3: Subquery3 This subquery has six layers to it with MedicalWholesaler, MedicineOrders, MedicineOrderLine, Shipping, MedicineManuf, and the SolidMedicine Table. It looks up what wholesaler purchased the solidmedicine that has a weight of 92.36. REM 4: Inner Join1 This inner join is a three way join and matches the Wholesaler_ID in the MedicalWholesaler table with the Wholesaler_ID in the MedicineManuf table then matches the Medicine_ID in the MedicineManuf table with the SMedicine_ID in the SolidMedicine Table to return the Wholesalers who purchased SolidMedicine and the Profit the MedicineManuf Made on each unit. REM 5: inner Join2 This is a four way join and returns information about MedicalWholesalers that have ordered $500,000 or more in medicine. REM 6: Inner Join3

This is a three way join and returns information about the average price and average cost of the Orders that are made by the MedicalWholesalers also shows the total revenue that the MedicineManuf are making from orders so far.

REM 7: Outer Join1 This is a three way join and returns the shipping information for the GasMedicine that has been ordered. REM 8: Outer Join2 This is a three way join and returns information about the SolidMedicine that was Ordered by MedicalWholesalers REM 9: Outer Join3 This is a three way join and returns information about the GasMedicine and its burn rate that were ordered. REM 10: Outer Join4 This is a four way join and displays information about the SoldiMedicine that was Ordered by the MedicalWholesalers.

Você também pode gostar