140 likes | 279 Views
MIS 2502. Decomposing BJ’s Wholesale club CJ Marselis. Business Rules.
E N D
MIS 2502 Decomposing BJ’s Wholesale club CJ Marselis
Business Rules BJ’s is interested in developing a new application. The database will track product, customer, and sale information. It will also collect basic store information. The business rules are typical of most retail stores with the exception that sales are tracked to the customer since the customer is a member. The specific rules include: • A product may be supplied by multiple suppliers • A manufacture produces many products but sells to clients through the supplier • A sale to a store includes many products • A sale to a customer may include many products • The sale to the customer includes the store number to facilitate returns • A store has only one manager • An employee can have only 1 position
A product may be supplied by multiple suppliers • M:N relationship between Product and Suppliers
A manufacture produces many products but sells to clients through the supplier • Let’s consider the relationship between manufacturer and products first • While a product COULD be produced by many manufacturers, let’s assume that this is not the case
A manufacture sells to clients through the supplier • In this case the client is the Store • Basically, we need a sale to show the purchase of the product from the manufacturer to the supplier BUT this is out of scope of this db. Since we’re building the DB for BJs and BJs wouldn’t want to store the purchases of the products by the supplier from the manufacturer, we won’t worry about this
A sale to a store from a supplier • Since BJs would want to know what products it ordered for each store from the suppliers, we need to house this information in our db • Essentially, this is just a sale! • Remember all sales include the following components: • Customer • Seller • Products • General Sale information • Details about the sale
Sale • Remember all sales include the following components: • Seller • Customer • Products • Since the seller sells to multiple customers and a customer buys from multiple sellers, it’s a M:N • Each time a customer buys stuff from a seller, it’s a sale – That’s the bridge! • In this case: • Seller = Supplier • Customer = Store • Sale = delivery invoice
Delivery Invoice • The Delivery Invoice shows the M:N between Store and Supplier • Need FKs to Store and Supplier • Deliver and order date • Could add employee that placed the order at the buyer. This will be FK to employee table
A sale to a store includes many products • The buyer can purchase many products in the sale. • Since an invoice includes many products and a product can be sold in many invoices, it’s a M:N between an invoice and product • Need to show the FKs to the product and invoice tables
The sale to the customer includes the store number to facilitate returns • Sale includes: • Seller = Store • Customer = Customer • Sale = Sale
Let’s say we want to track which cashier rang up the sale. An employee can have only 1 position • Add cashier as FK to Employee Lookup
A sale to a customer may include many products • Just like the invoice detail table, need a bridge between sale and products