Task1
Task1
Database Systems
Assignment 1
1
Contents
Task 1.........................................................................................................................................3
Task 2.........................................................................................................................................4
Task 3.........................................................................................................................................4
2
Task 1
Entity Attributes Unique Identifier
Branch - Branch ID Branch ID
- Name
- Address
- Number of Employees
- Days Open (Mon-Sun)
- Opening Hours
Product - Product ID Product ID
- Type (wine/beer/spirit/...)
- Subtype (e.g., red/ale/vodka)
- Packaging Info (can/bottle/...)
- Volume (e.g., 375ml X 6 pack)
- Price
- Brand
- Current Stock Level
Staff - Staff ID Staff ID
- Role
- Type of Employment (permanent, casual)
- Employment Start Date
- Employment End Date (if applicable)
- Salary (annual or hourly)
- Supervisor ID
AL Member - Member ID Member ID
- Type of Membership (Platinum/Gold/Silver)
- Expiry Date
- Joining Date
3
Task 2
Figure 1: ER Diagram
Task 3
Physical Design
4
NumEmployees
DaysOpen
OpeningHours
2. Product:
ProductID (Primary Key)
Type
Subtype
PackagingInfo
Volume
Price
Brand
CurrentStockLevel
3. Staff:
StaffID (Primary Key)
Role
EmploymentType
EmploymentStartDate
EmploymentEndDate
Salary
4. ALMember:
MemberID (Primary Key)
MembershipType
ExpiryDate
JoiningDate
For each entity, a primary key (PK) uniquely identifies each record in that entity. It
ensures that no duplicate records exist.
Foreign keys establish relationships between entities. They refer to the primary key of
another entity. In the provided case study, we have the following foreign keys:
Staff - BranchID (FK): Staff members work at branches, and the Staff entity
references the Branch entity using the BranchID as a foreign key.
5
Branch - StaffID (FK): Branches are managed by staff members, and the Branch
entity references the Staff entity using the StaffID as a foreign key.
ALMember - BranchID (FK): AL Members are associated with branches, and the
ALMember entity references the Branch entity using the BranchID as a foreign key.
Explanation:
1. Branch Entity:
The primary key BranchID uniquely identifies each branch.
Other attributes such as Name, Address, NumEmployees, DaysOpen, and
OpeningHours store information about the branch.
2. Product Entity:
The primary key ProductID uniquely identifies each product.
Attributes such as Type, Subtype, PackagingInfo, Volume, Price, Brand, and
CurrentStockLevel provide details about the product.
3. Staff Entity:
The primary key StaffID uniquely identifies each staff member.
Attributes like Role, EmploymentType, EmploymentStartDate,
EmploymentEndDate, and Salary store staff-related information.
The foreign key BranchID establishes a relationship between Staff and Branch
entities, indicating the branch where the staff member works.
4. ALMember Entity:
The primary key MemberID uniquely identifies each AL Member.
Attributes such as MembershipType, ExpiryDate, and JoiningDate contain
information about the membership.
The foreign key BranchID establishes a relationship between ALMember and
Branch entities, indicating the branch where the member belongs.
This physical design outlines the tables and relationships necessary to represent the data in a
relational database. Primary keys ensure data integrity, and foreign keys establish connections
between related entities. This design allows for efficient storage and retrieval of information
while maintaining data consistency.