- Mar 26, 2005
- 4,094
- 123
- 106
So I got a huge SQL homework.. I need to design a set of tables, build an ERD in MySQL workbench, implement my tables in Microsoft SQL Server Express and finally, create some queries that will pull needed data.
I need help with the design step, because if I mess this up, everything else will be doomed. I want to make sure I do this right.
Here's my instructions:
So far, here's the tables I came up with.
Customer(CustomerID,FirstName, LastName, Address,PhoneNumber, EbtCardID)
Purchases(PurchaseID,Date, Total, Amount, CustomerID
Items(ItemID, ItemName, UnitPrice, Category, Food(Bool), Taxable(Bool))
SaleItem (ItemID, DateStartSale, DateEndSale, SalePrice)
I am pretty sure I am missing a few things but it's not so easy for me to see what is it that I am missing. Please help out.
Thanks very much.
I need help with the design step, because if I mess this up, everything else will be doomed. I want to make sure I do this right.
Here's my instructions:
Code:
Specifications:
A local supermarket has decided to keep a record of customer purchases for each of its steady customers.
[b]Part A[/b]
Design a set of tables (a database) that will effectively store the data that is described below, providing easy retrieval and ensuring data integrity and validity.
Identify each tables attributes, PK and FKs if any.
Identify which fields are mandatory or optional.
Each steady customer is asked to provide the following information: first name, lastname, address and phoneNumber. A customer can also choose to store his EBT card ID in his record. All this data is stored in the database.
An EBT card is issued by the government and covers expenses incurred for food item purchases only. Each month the government adds money to the current balance of the EBT card. The balance is reduced each time a Customer makes food purchases and uses the EBT card to pay for those purchases.
Each time a Customer makes a purchase the system will store a record of that purchase. To view the type of data stored refer to the receipt that appears on the next page.
If the Customer pays with a creditcard the creditcard information is also stored.
Some customers pay with cash in which case no creditcard information is stored.
If a Customer pays using his EBT card, the purchase record will store how much money was paid using an EBT card and the EBT card balance will be reduced by the amount purchased.
Note:
For each Item that is purchased the system stores the item id, name of the item, unit price, category (ALUMINUM, FRUIT, PAPERGOODS, GROCERY, POULTRY, MEAT, MILKPRODUCTS, FISH,BAKERY, CANDY), Food(Y/N), Taxable(Y/N)
When the store runs a sale the supermarket records the following data for each SaleItem : itemid, date start sale, date end sale, sale price
Not every item is taxable. When a customer purchases a taxable item the customer must pay tax on that item. Current tax is .089 * item price.
[b]Part B[/b]
Create and implement the design you have outlined in part a, using SQL Server
Populate the database with a reasonable set of data
Receipt No:
Date: Time:
Cashier Name: Register #:
Customer Name: Mr. X
100 Ave X
Brooklyn, NY 11229
ALUMINUM
14 Aluminum Lid Oblong #788 @ 1/.10 1.40 T
12 Aluminum Oblong # 2062 @ 6/1.00 2.00 T
4 Aluminum 9 x 13 shallow #320 @1/.33 1.32 T
BAKERY
Bakery Rye Bread 2.39 F
Pita 2.19 F
CANDY/NUTS
2 Wise Potato Chips Bags @ 1/.99 1.98 F T
1 Hersheys Chocoate Bar @1/2.00 2.00 F T
NEWSPAPERS/MAGAZINES
Readers Digest 2.00 T
FRUIT
Potatoes Idaho 5 lb 1.69 F
1.57 lb Tomatoes @ 1/.99 1.55 F
2 Onions 3 lb @ 1/.99 Sale 1/.69 1.38 F
2 Mangoes @ 1/1.19 Sale 1/.89 1.78 F
GROCERY
2 Fleishman Margarine @ 1/2.49 4.98 F
Ajax Bleach Cleanser 1.29 T
Uncle Bens Rice 5 lb 7.99 F
2 Dozen Eggs @ 1/1.39 2.78 F
3 Helmanns Mayo @ 1/5.49 Sale 1 / 2.99 8.97 F
POULTRY
Chicken Legs Family Pack 15.00 F
MEAT
4lb Shoulder Roast @1/ 8.00 32.00 F
FISH
2 lb Salmon Fillet @ 1/7.99 15.98 F
Total 110.67
Tax On: 11.99 1.06
Total: 111.73
Paid with Credit Card ID: xxxxxxxx4432 111.73
So far, here's the tables I came up with.
Customer(CustomerID,FirstName, LastName, Address,PhoneNumber, EbtCardID)
Purchases(PurchaseID,Date, Total, Amount, CustomerID
Items(ItemID, ItemName, UnitPrice, Category, Food(Bool), Taxable(Bool))
SaleItem (ItemID, DateStartSale, DateEndSale, SalePrice)
I am pretty sure I am missing a few things but it's not so easy for me to see what is it that I am missing. Please help out.
Thanks very much.
Last edited: