Project Rdbms (1) Maen
Project Rdbms (1) Maen
SOCS010102
Relational Database Management System
Date: 31/12/2024
- RELATIONSHIPS 6
2. ENTITY RELATIONSHIP DIAGRAM 8
3. COMMNAND 9
- DDL COMMANDS 9
- ALTER TABLE COMMANDS 9
- JOINS 11
- SET OPERATIONS 11
5. NORMALIZATION 12
1. Staff Management:
o Maintain detailed records of staff members, including their roles,
shifts, and assignments.
o Facilitate task allocation and scheduling for cleaning and maintenance
operations.
2. Room Management:
o Track the status, type, and occupancy of rooms.
o Monitor rooms requiring cleaning or maintenance services.
3. Task Management:
o Automate the scheduling and tracking of cleaning and maintenance
tasks.
o Record task details, including descriptions, assignments, and
completion dates.
4. Inventory Management:
o Keep track of housekeeping supplies, their availability, and associated
suppliers.
o Manage restocking requirements and monitor inventory usage.
5. Maintenance Requests:
o Log maintenance issues, prioritize tasks, and assign them to
appropriate staff.
o Track the status and resolution of maintenance requests.
7. Scheduling System:
o Organize staff shifts and room-specific tasks based on schedules.
o Ensure timely task completion by integrating schedules with task
allocation.
1 Staff Table
Attribute Data Type Constraint Description
StaffID INT(3) PRIMARY Unique identifier for each staff member
KEY
Name VARCHAR(15) NOT NULL Full name of the staff member
Position VARCHAR(15) NOT NULL Role or position (e.g., cleaner, manager)
PhoneNumber INT(10) UNIQUE Contact phone number
KEY
Email VARCHAR(20) UNIQUE Email address
KEY
HireDate DATE NOT NULL Date the staff member was hired
4. Inventory Table
Attribute Data Type Constraint Description
ItemID INT(3) PRIMARY KEY Unique identifier for each
inventory item
ItemName VARCHAR2(20) NOT NULL Name of the inventory item
Quantity INT(3) NOT NULL Current quantity in stock
SupplierID INT(3) FOREIGN KEY References SupplierID in
Suppliers Table
RestockThreshold INT(3) NOT NULL Minimum quantity before
restock is needed
LastRestockedDate DATE NOT NULL Last date when the item was
restocked
6. Suppliers Table
Attribute Data Type Constraint Description
SupplierID INT(3) PRIMARY KEY Unique identifier for each
supplier
SupplierName VARCHAR2(20) NOT NULL Name of the supplier
ContactPerson VARCHAR2(20) NOT NULL Primary contact person's name
PhoneNumber INT(10) NOT NULL Contact phone number
Email VARCHAR2(20) UNIQUE KEY Email address for
correspondence
Address VARCHAR2(20) NOT NULL Address of the supplier
7. Schedules table
Relationship: One staff member can have multiple schedule entries, but each
schedule entry involves only one staff member.
Relationship: One room can have multiple cleaning tasks, but each cleaning
task is associated with only one room.
Relationship: One room can have multiple maintenance requests, but each
maintenance request is associated with only one room
Relationship: One room can have multiple schedule entries, but each schedule
entry is linked to only one room.
Relationship: One supplier can provide multiple inventory items, but each
inventory item is supplied by only one supplier.
Features:
DDL Command.
4. Data Manipulation.
2) Sorting:
i) (List all staff members ordered by their hire date (oldest to newest).
Ans) SELECT * FROM Staff ORDER BY HireDate ASC;
3) Grouping:
i) (Count the number of staff members in each position).
Ans) SELECT Position, COUNT(*) AS StaffCount FROM Staff GROUP BY
Position;
4. Set Operations
1). UNION
i) Get a combined list of all staff names and supplier names (distinct values).
2). INTERSECT
ii) Find names that exist both as staff names and supplier names.
3). EXCEPT
iii) Get all room numbers that are not assigned to any task.
From the schema you provided, all tables already follow 1NF since each attribute
contains atomic values, and there are primary keys for each table.
2NF requires:
1. Staff Table: Already in 2NF because all non-key attributes (Name, Position,
PhoneNumber, Email, HireDate) are fully dependent on the primary key
(StaffID).
3NF requires:
Staff Table
o StaffID (Primary Key)
o Name
o Position
o PhoneNumber (Unique)
o Email (Unique)
o HireDate
Tasks Table
o TaskID (Primary Key)
o StaffID (Foreign Key)
o RoomID (Foreign Key)
o TaskDescription
o TaskDate
o CompletionStatus
Inventory Table
o ItemID (Primary Key)
o ItemName
o Quantity
o SupplierID (Foreign Key)
o RestockThreshold
o LastRestockedDate
MaintenanceRequests Table
o RequestID (Primary Key)
o RoomID (Foreign Key)
o AssignedStaffID (Foreign Key)
o RequestDescription
o RequestDate
o PriorityLevel
o CompletionStatus
Suppliers Table
o SupplierID (Primary Key)
o SupplierName
o ContactPerson
o PhoneNumber (Unique)
o Email (Unique)
o Address
Conclusion
Your database schema appears to be well-structured and already adheres to 3NF. The
tables avoid redundancy and ensure that all non-key attributes are fully dependent on
the primary key, with no transitive dependencies. This structure will help ensure data
consistency, minimize duplication, and enhance the efficiency of queries.