Assignment No.
01
FAIQA SHAHZADI
Fall 2024
CS406 – Web Based Database Applications (BC230209196)
Questions No.1: 10 Marks
Components to Design an ER Diagram for Style Maker:
1. Identifying Key Entities
The main entities Style Maker would need include:
Product: Represents each clothing item.
Customer: Represents individuals who purchase items.
Order: Represents customer orders.
Employee: Represents the team managing store operations.
Supplier: Represents suppliers who provide products.
2. Specifying Attributes for Each Entity
We’ll categorize attributes based on type: simple, composite, derived, single-valued, and multi-valued.
1. Product
o ProductID (Primary Key, Simple, Single-valued)
o Brand (Simple, Single-valued)
o Category (Simple, Single-valued, e.g., shirt, pants)
o Price (Simple, Single-valued)
o Size (Multi-valued, e.g., small, medium, large)
o Availability (Derived, based on stock)
2. Customer
o CustomerID (Primary Key, Simple, Single-valued)
o Name (Composite, includes FirstName, LastName)
o Email (Candidate Key, Simple, Single-valued)
o Phone (Simple, Single-valued)
o Address (Composite, includes Street, City, PostalCode)
o MembershipStatus (Simple, Single-valued, e.g., regular, premium)
3. Order
o OrderID (Primary Key, Simple, Single-valued)
o OrderDate (Simple, Single-valued)
o TotalAmount (Derived, based on product prices in the order)
o Status (Simple, Single-valued, e.g., pending, completed)
o CustomerID (Foreign Key, linking to Customer)
4. Employee
o EmployeeID (Primary Key, Simple, Single-valued)
o Name (Composite, includes FirstName, LastName)
o Role (Simple, Single-valued, e.g., manager, sales assistant)
o Salary (Simple, Single-valued)
o Phone (Simple, Single-valued)
o Address (Composite, includes Street, City, PostalCode)
5. Supplier
o SupplierID (Primary Key, Simple, Single-valued)
o Name (Simple, Single-valued)
o ContactNumber (Simple, Single-valued)
o Address (Composite, includes Street, City, PostalCode)
o Email (Candidate Key, Simple, Single-valued)
3. Primary Keys and Candidate Keys
Each entity has a primary key (ProductID, CustomerID, OrderID, EmployeeID, SupplierID).
Candidate keys include attributes like Email in Customer and Supplier.
4. Defining Relationships and Mapping Cardinalities
1. Product and Supplier
o Relationship: Supplies
o Cardinality: Many-to-Many (A product can have multiple suppliers, and each supplier can supply
multiple products).
2. Customer and Order
o Relationship: Places
o Cardinality: One-to-Many (A customer can place multiple orders, but each order belongs to one
customer).
3. Order and Product
o Relationship: Contains
o Cardinality: Many-to-Many (An order can contain multiple products, and a product can appear in
multiple orders).
4. Employee and Order
o Relationship: Handles
o Cardinality: One-to-Many (Each order is handled by one employee, but an employee can handle
multiple orders).