Purpose: To demonstrate your ability to analyze a business scenario and create a “real world” database
Assignment: Create a database for a small e-commerce web site. As a minimum, it should include the following entities:
- Customer – name, address, city, state, zip, etc.
- Inventory – description, category, quantity on hand, unit price, etc.
- Order – date, payment info, etc.
- OrderDetail – typical shopping cart line items
- Supplier – vendor info to include MainPhone, SalesPhone, ShippingPhone, and BillingPhone
- StateFees – list of 50 states and the sales tax and shipping costs
- Inventory and Supplier start out as a N:M, so you’ll need to fix that
- The fee info is: 1) Charge 6.25% tax in Texas 2) Charge 8.25% tax in California, 3) All other states have 0% tax…. and 4) Charge $4 to ship to TX, LA, OK, NM, 5) Charge $8 to ship to AK and HI, and 6) Charge $6 shipping to all other states.
- Real databases do not always allow you delete records, so please account for this in your table design
- Use the database diagram to ensure that there are no “orphan” tables
As a minimum, You must create Views, Table Functions, or Scalar Functions for the following:
- query to produce the extended price (a single value) for a given Order and a given Line Item
- query to show all order activity details for a given Customer
- query to show the total cost (cost of items + tax + shipping) for a given order
- query to show the total sales (in $) for each month
- query to show the total sales (in $) for each category of product
- create a view to demonstrate the use of each of the functions above
- You need to have enough sample data in your database to be able to demonstrate that each query works
Notes: You must provide an MDF file from SQL Server 2017… not a later version!
Expectations: A single “detached” Microsoft SQL Server 2017 database file (an *.mdf file)