Based on the X Hotel case study and your ERD design, here's a comprehensive example of data in UNF - a single flat table containing all information that would typically be collected in the hotel booking system:
| HotelID | HotelName | EmailAddress | BranchID | BranchLocation | ManagerID | ManagerName | ManagerEmail | ManagerPhone | CustomerID | FirstName | LastName | CustomerEmail | ContactNumber | Address | ReservationID | BookingDate | CheckInDate | CheckOutDate | EmergencyContact | SpecialRequests | RoomID | RoomNumber | RoomType | RoomRate | Capacity | RoomAvailable | CheckInID | CheckInTime | CheckOutID | CheckOutTime | InvoiceID | InvoiceDescription | TotalAmount | CustomerName | FeedbackID | Rating | Review |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| H001 | X Hotel | info@xhotel.com | BR001 | Kuala Lumpur | M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 | C001 | John | Smith | john@email.com | 0123456789 | 123 Main St, KL | R001 | 2024-01-15 | 2024-02-01 | 2024-02-03 | 0198765432 | Late check-in, Non-smoking room | RM001, RM002 | 101, 102 | Standard Double, Standard Twin | 150.00, 120.00 | 2, 2 | Yes, Yes | CI001 | 2024-02-01 15:30 | CO001 | 2024-02-03 11:00 | I001 | Room charges for 2 nights | 540.00 | John Smith | F001 | 5 | Excellent service and clean rooms! |
| H001 | X Hotel | info@xhotel.com | BR002 | Penang | M002 | Siti Hassan | siti@xhotel.com | 0187654322 | C002 | Mary | Johnson | mary@email.com | 0123456790 | 456 Oak Ave, Penang | R002 | 2024-01-20 | 2024-02-10 | 2024-02-12 | 0198765433 | Room service, High floor | RM003 | 201 | Deluxe Double | 200.00 | 2 | Yes | CI002 | 2024-02-10 14:00 | CO002 | 2024-02-12 10:30 | I002 | Deluxe room for 2 nights | 400.00 | Mary Johnson | F002 | 4 | Great location, good facilities |
| H001 | X Hotel | info@xhotel.com | BR001 | Kuala Lumpur | M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 | C003 | David | Lee | david@email.com | 0123456791 | 789 Pine St, KL | R003 | 2024-01-25 | 2024-02-15 | 2024-02-17 | 0198765434 | Quiet room, Extra pillows | RM004 | 103 | Standard Double | 150.00 | 2 | Yes | CI003 | 2024-02-15 16:00 | CO003 | 2024-02-17 11:30 | I003 | Standard room booking | 300.00 | David Lee | F003 | 3 | Average experience, room was okay |
Critical Problems with UNF:
Rule for 1NF:
Actions Taken:
| HotelID | HotelName | EmailAddress | BranchID | BranchLocation | ManagerID | ManagerName | ManagerEmail | ManagerPhone | CustomerID | FirstName | LastName | CustomerEmail | ContactNumber | Address | ReservationID | BookingDate | CheckInDate | CheckOutDate | EmergencyContact | SpecialRequests | RoomID | RoomNumber | RoomType | RoomRate | Capacity | RoomAvailable | CheckInID | CheckInTime | CheckOutID | CheckOutTime | InvoiceID | InvoiceDescription | TotalAmount | CustomerName | FeedbackID | Rating | Review |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| H001 | X Hotel | info@xhotel.com | BR001 | Kuala Lumpur | M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 | C001 | John | Smith | john@email.com | 0123456789 | 123 Main St, KL | R001 | 2024-01-15 | 2024-02-01 | 2024-02-03 | 0198765432 | Late check-in, Non-smoking room | RM001 | 101 | Standard Double | 150.00 | 2 | Yes | CI001 | 2024-02-01 15:30 | CO001 | 2024-02-03 11:00 | I001 | Room charges for 2 nights | 540.00 | John Smith | F001 | 5 | Excellent service and clean rooms! |
| H001 | X Hotel | info@xhotel.com | BR001 | Kuala Lumpur | M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 | C001 | John | Smith | john@email.com | 0123456789 | 123 Main St, KL | R001 | 2024-01-15 | 2024-02-01 | 2024-02-03 | 0198765432 | Late check-in, Non-smoking room | RM002 | 102 | Standard Twin | 120.00 | 2 | Yes | CI001 | 2024-02-01 15:30 | CO001 | 2024-02-03 11:00 | I001 | Room charges for 2 nights | 540.00 | John Smith | F001 | 5 | Excellent service and clean rooms! |
| H001 | X Hotel | info@xhotel.com | BR002 | Penang | M002 | Siti Hassan | siti@xhotel.com | 0187654322 | C002 | Mary | Johnson | mary@email.com | 0123456790 | 456 Oak Ave, Penang | R002 | 2024-01-20 | 2024-02-10 | 2024-02-12 | 0198765433 | Room service, High floor | RM003 | 201 | Deluxe Double | 200.00 | 2 | Yes | CI002 | 2024-02-10 14:00 | CO002 | 2024-02-12 10:30 | I002 | Deluxe room for 2 nights | 400.00 | Mary Johnson | F002 | 4 | Great location, good facilities |
| H001 | X Hotel | info@xhotel.com | BR001 | Kuala Lumpur | M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 | C003 | David | Lee | david@email.com | 0123456791 | 789 Pine St, KL | R003 | 2024-01-25 | 2024-02-15 | 2024-02-17 | 0198765434 | Quiet room, Extra pillows | RM004 | 103 | Standard Double | 150.00 | 2 | Yes | CI003 | 2024-02-15 16:00 | CO003 | 2024-02-17 11:30 | I003 | Standard room booking | 300.00 | David Lee | F003 | 3 | Average experience, room was okay |
Primary Key: (ReservationID, RoomID)
Achievements:
Rule for 2NF:
Functional Dependencies Analysis:
Primary Key: (ReservationID, RoomID)
Full Dependencies (depend on both ReservationID AND RoomID):
- None identified (this is the problem!)
Partial Dependencies (depend on only part of the key):
ReservationID → CustomerID, FirstName, LastName, CustomerEmail, ContactNumber, Address, BookingDate, CheckInDate, CheckOutDate, EmergencyContact, SpecialRequests, BranchID, CheckInID, CheckInTime, CheckOutID, CheckOutTime, InvoiceID, InvoiceDescription, TotalAmount, CustomerName, FeedbackID, Rating, Review
RoomID → RoomNumber, RoomType, RoomRate, Capacity, RoomAvailable, BranchID
Additional Dependencies:
CustomerID → FirstName, LastName, CustomerEmail, ContactNumber, Address
BranchID → BranchLocation, ManagerID, HotelID
ManagerID → ManagerName, ManagerEmail, ManagerPhone
HotelID → HotelName, EmailAddress
InvoiceID → InvoiceDescription, TotalAmount, CustomerName
FeedbackID → Rating, Review
CheckInID → CheckInTime
CheckOutID → CheckOutTimeActions Taken: Create separate tables to eliminate partial dependencies
| HotelID | HotelName | EmailAddress |
|---|---|---|
| H001 | X Hotel | info@xhotel.com |
Primary Key: HotelID
| ManagerID | ManagerName | ManagerEmail | ManagerPhone |
|---|---|---|---|
| M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 |
| M002 | Siti Hassan | siti@xhotel.com | 0187654322 |
Primary Key: ManagerID
| BranchID | BranchLocation | ManagerID | HotelID |
|---|---|---|---|
| BR001 | Kuala Lumpur | M001 | H001 |
| BR002 | Penang | M002 | H001 |
Primary Key: BranchID Foreign Keys: ManagerID → Manager(ManagerID), HotelID → Hotel(HotelID)
| CustomerID | FirstName | LastName | CustomerEmail | ContactNumber | Address |
|---|---|---|---|---|---|
| C001 | John | Smith | john@email.com | 0123456789 | 123 Main St, KL |
| C002 | Mary | Johnson | mary@email.com | 0123456790 | 456 Oak Ave, Penang |
| C003 | David | Lee | david@email.com | 0123456791 | 789 Pine St, KL |
Primary Key: CustomerID Unique Constraint: CustomerEmail
| RoomID | RoomNumber | RoomType | RoomRate | Capacity | RoomAvailable | BranchID |
|---|---|---|---|---|---|---|
| RM001 | 101 | Standard Double | 150.00 | 2 | Yes | BR001 |
| RM002 | 102 | Standard Twin | 120.00 | 2 | Yes | BR001 |
| RM003 | 201 | Deluxe Double | 200.00 | 2 | Yes | BR002 |
| RM004 | 103 | Standard Double | 150.00 | 2 | Yes | BR001 |
Primary Key: RoomID Foreign Key: BranchID → Branch(BranchID)
| ReservationID | CustomerID | BranchID | BookingDate | CheckInDate | CheckOutDate | EmergencyContact | SpecialRequests |
|---|---|---|---|---|---|---|---|
| R001 | C001 | BR001 | 2024-01-15 | 2024-02-01 | 2024-02-03 | 0198765432 | Late check-in, Non-smoking room |
| R002 | C002 | BR002 | 2024-01-20 | 2024-02-10 | 2024-02-12 | 0198765433 | Room service, High floor |
| R003 | C003 | BR001 | 2024-01-25 | 2024-02-15 | 2024-02-17 | 0198765434 | Quiet room, Extra pillows |
Primary Key: ReservationID Foreign Keys: CustomerID → Customer(CustomerID), BranchID → Branch(BranchID)
| ReservationID | RoomID |
|---|---|
| R001 | RM001 |
| R001 | RM002 |
| R002 | RM003 |
| R003 | RM004 |
Primary Key: (ReservationID, RoomID) Foreign Keys: ReservationID → Reservation(ReservationID), RoomID → Room(RoomID)
| CheckInID | ReservationID | CheckInTime |
|---|---|---|
| CI001 | R001 | 2024-02-01 15:30 |
| CI002 | R002 | 2024-02-10 14:00 |
| CI003 | R003 | 2024-02-15 16:00 |
Primary Key: CheckInID Foreign Key: ReservationID → Reservation(ReservationID)
| CheckOutID | ReservationID | CheckOutTime |
|---|---|---|
| CO001 | R001 | 2024-02-03 11:00 |
| CO002 | R002 | 2024-02-12 10:30 |
| CO003 | R003 | 2024-02-17 11:30 |
Primary Key: CheckOutID Foreign Key: ReservationID → Reservation(ReservationID)
| InvoiceID | ReservationID | InvoiceDescription | TotalAmount | CustomerName |
|---|---|---|---|---|
| I001 | R001 | Room charges for 2 nights | 540.00 | John Smith |
| I002 | R002 | Deluxe room for 2 nights | 400.00 | Mary Johnson |
| I003 | R003 | Standard room booking | 300.00 | David Lee |
Primary Key: InvoiceID Foreign Key: ReservationID → Reservation(ReservationID)
| FeedbackID | ReservationID | Rating | Review |
|---|---|---|---|
| F001 | R001 | 5 | Excellent service and clean rooms! |
| F002 | R002 | 4 | Great location, good facilities |
| F003 | R003 | 3 | Average experience, room was okay |
Primary Key: FeedbackID Foreign Key: ReservationID → Reservation(ReservationID)
Achievements:
Rule for 3NF:
Transitive Dependencies Analysis:
Transitive Dependencies Found:
In Invoice table:
ReservationID → CustomerID → FirstName, LastName (CustomerName)
This creates: InvoiceID → ReservationID → CustomerID → CustomerName
In Branch table:
BranchID → ManagerID → ManagerName, ManagerEmail, ManagerPhone
(Already properly normalized - Manager is separate entity)
In Room table:
RoomID → BranchID → BranchLocation, ManagerID, HotelID
(Already properly normalized - Branch is separate entity)Actions Taken: Remove transitive dependencies
| HotelID | HotelName | EmailAddress |
|---|---|---|
| H001 | X Hotel | info@xhotel.com |
Primary Key: HotelID
| ManagerID | ManagerName | ManagerEmail | ManagerPhone |
|---|---|---|---|
| M001 | Ahmad Ali | ahmad@xhotel.com | 0187654321 |
| M002 | Siti Hassan | siti@xhotel.com | 0187654322 |
Primary Key: ManagerID
| BranchID | BranchLocation | ManagerID | HotelID |
|---|---|---|---|
| BR001 | Kuala Lumpur | M001 | H001 |
| BR002 | Penang | M002 | H001 |
Primary Key: BranchID Foreign Keys: ManagerID → Manager(ManagerID), HotelID → Hotel(HotelID)
| CustomerID | FirstName | LastName | CustomerEmail | ContactNumber | Address |
|---|---|---|---|---|---|
| C001 | John | Smith | john@email.com | 0123456789 | 123 Main St, KL |
| C002 | Mary | Johnson | mary@email.com | 0123456790 | 456 Oak Ave, Penang |
| C003 | David | Lee | david@email.com | 0123456791 | 789 Pine St, KL |
Primary Key: CustomerID Unique Constraint: CustomerEmail
| RoomID | RoomNumber | RoomType | RoomRate | Capacity | BranchID |
|---|---|---|---|---|---|
| RM001 | 101 | Standard Double | 150.00 | 2 | BR001 |
| RM002 | 102 | Standard Twin | 120.00 | 2 | BR001 |
| RM003 | 201 | Deluxe Double | 200.00 | 2 | BR002 |
| RM004 | 103 | Standard Double | 150.00 | 2 | BR001 |
Primary Key: RoomID Foreign Key: BranchID → Branch(BranchID) Note: RoomAvailable removed (should be calculated based on reservations)
| ReservationID | CustomerID | BranchID | BookingDate | CheckInDate | CheckOutDate | EmergencyContact | SpecialRequests |
|---|---|---|---|---|---|---|---|
| R001 | C001 | BR001 | 2024-01-15 | 2024-02-01 | 2024-02-03 | 0198765432 | Late check-in, Non-smoking room |
| R002 | C002 | BR002 | 2024-01-20 | 2024-02-10 | 2024-02-12 | 0198765433 | Room service, High floor |
| R003 | C003 | BR001 | 2024-01-25 | 2024-02-15 | 2024-02-17 | 0198765434 | Quiet room, Extra pillows |
Primary Key: ReservationID Foreign Keys: CustomerID → Customer(CustomerID), BranchID → Branch(BranchID)
| ReservationID | RoomID |
|---|---|
| R001 | RM001 |
| R001 | RM002 |
| R002 | RM003 |
| R003 | RM004 |
Primary Key: (ReservationID, RoomID) Foreign Keys: ReservationID → Reservation(ReservationID), RoomID → Room(RoomID)
| CheckInID | ReservationID | CheckInTime |
|---|---|---|
| CI001 | R001 | 2024-02-01 15:30 |
| CI002 | R002 | 2024-02-10 14:00 |
| CI003 | R003 | 2024-02-15 16:00 |
Primary Key: CheckInID Foreign Key: ReservationID → Reservation(ReservationID)
| CheckOutID | ReservationID | CheckOutTime |
|---|---|---|
| CO001 | R001 | 2024-02-03 11:00 |
| CO002 | R002 | 2024-02-12 10:30 |
| CO003 | R003 | 2024-02-17 11:30 |
Primary Key: CheckOutID Foreign Key: ReservationID → Reservation(ReservationID)
| InvoiceID | ReservationID | InvoiceDescription | TotalAmount | PaymentDate |
|---|---|---|---|---|
| I001 | R001 | Room charges for 2 nights | 540.00 | 2024-01-16 |
| I002 | R002 | Deluxe room for 2 nights | 400.00 | 2024-01-21 |
| I003 | R003 | Standard room booking | 300.00 | 2024-01-26 |
Primary Key: InvoiceID Foreign Key: ReservationID → Reservation(ReservationID) Note: CustomerName removed (get from Reservation → Customer relationship)
| FeedbackID | ReservationID | Rating | Review |
|---|---|---|---|
| F001 | R001 | 5 | Excellent service and clean rooms! |
| F002 | R002 | 4 | Great location, good facilities |
| F003 | R003 | 3 | Average experience, room was okay |
Primary Key: FeedbackID Foreign Key: ReservationID → Reservation(ReservationID)
This 3NF design provides a robust, scalable foundation for X Hotel's booking management system that fully meets all case study requirements while maintaining optimal database structure.