Comp1821 Notes

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Management asks:

1) Top 10 selling products


2) Top 10 highest spending customers
3) Monthly sales
4) Top 10 suppliers (that supply the most products)
5) Busiest day in a week (most customers) - most number of TRANSACTIONS

Entity
------
customer
sales
product
supplier

Customer Entity
---------------
- Attribute: id - PRIMARY KEY (unique and cannot be empty/null)
- Attribute: IC
- Attribute: name
- Attribute: mobile
- Attribute: email
- Attribute: date of birth
- Attribute: address (composite attribute)
-> unit number
-> street name
-> post code
-> suburb
-> city
-> country

Sales Entity
------------
- Attribute: total paid (derived attribute)
- Attribute: product
- Attribute: quantity
- Attribute: price
- Attribute: number of products sold (derived attribute)
- Attribute: sales id/invoice number/transaction id/transaction number - PRIMARY
KEY
- Attribute: date
- Attribute: time
- Attribute: cashier
- Attribute: payment mode (multivalued attribute)
-> cash
-> voucher
- Attribute: discount

McD Receipt
Apple Pie x 2 (quantity)
McChicken x 4 (quantity)
Number of products sold (2)
Number of products sold (6)
Number of items sold (6)

Product Entity
--------------
- id - PRIMARY KEY
- name
- price
- sku (stock keeping unit)
- expiration date
- manufacturer
- inventory level
- waybill number
- dimension

Supplier Entity
---------------
- id - PRIMARY KEY
- name
- email
- address
- phone

ENTITY-RELATIONSHIP DIAGRAM (ERD) - Partially Done

+----------+ 1 M +-------+ M N +-------+ M


1 +----------+
| Supplier |----< SUPPLIES >----|Product|----< SOLD IN >----| Sales |-------
< BUYS >-------| Customer |
+----------+ +-------+ +-------+
+----------+

Customer-Sales is a 1-to-many relationship.


Product-Sales is a many-to-many relationship. ==> Need to fix this by
adding an ASSOCIATIVE ENTITY.
Supplier-Product is a 1-to-many relationship.

ENTITY-RELATIONSHIP DIAGRAM (ERD) - Completed

+----------+ 1 M +-------+ 1 M
+---------------+ M 1 +-------+ M 1 +----------+
| Supplier |----< SUPPLIES >----|Product|----< CAPTURED IN >----| Sales-
Details |---< CONTAINS >---| Sales |----< BUYS >----| Customer |
+----------+ +-------+
+---------------+ +-------+ +----------+

Sales-Details is an ASSOCIATIVE ENTITY.


Customer-Sales is a 1-to-many relationship.
Sales-SalesDetails is a 1-to-many relationship.
Product-SalesDetails is a 1-to-many relationship.
Supplier-Product is a 1-to-many relationship.

You might also like