| | 46 | |
| | 47 | == 1NF decomposition |
| | 48 | |
| | 49 | '''Relation:''' PROPERTY_MANAGEMENT_SYSTEM |
| | 50 | |
| | 51 | '''Functional dependencies in this relation:''' FD1-FD10 |
| | 52 | |
| | 53 | '''Candidate Keys:''' |
| | 54 | * {appointment_id, architect_id} |
| | 55 | |
| | 56 | '''Primary Key:''' {appointment_id, architect_id} |
| | 57 | |
| | 58 | '''Normal Form Status:''' Relation is in 1NF, all attributes are atomic, there are no repeating groups and we have a primary key |
| | 59 | |
| | 60 | '''Issues:''' Due to the existance of partial dependencies this relation does not conform to 2NF. In FD1 the admin_id is not part of key but determines attributes, in FD2 the building_id is not part of key, in FD3 the architect_id is part of key but determines attributes independently, in FD4-FD10 all have determinants that are not the full composite key. |
| | 61 | |
| | 62 | '''Decomposition strategy:''' Each entity is extracted into its own relation based on defined functional dependencies, starting with entities that have single-attribute determinants. |
| | 63 | |
| | 64 | '''Decomposition:''' |
| | 65 | |
| | 66 | {{{ |
| | 67 | R1_ADMIN(admin_id, admin_name, admin_email, admin_password) |
| | 68 | PK: admin_id, FD: FD1 |
| | 69 | |
| | 70 | R2_BUILDING(building_id, building_name, building_address, building_description, admin_id) |
| | 71 | PK: building_id, FK: admin_id, FD: FD2 |
| | 72 | |
| | 73 | R3_ARCHITECT(architect_id, architect_full_name, architect_contact_info) |
| | 74 | PK: architect_id, FD: FD3 |
| | 75 | |
| | 76 | R4_DESIGNS(building_id, architect_id) |
| | 77 | PK: {building_id, architect_id}, FK: building_id, architect_id |
| | 78 | |
| | 79 | R5_FLOOR(floor_id, floor_number, floor_layout_image, building_id) |
| | 80 | PK: floor_id, FK: building_id, FD: FD4 |
| | 81 | |
| | 82 | R6_UNIT(unit_id, unit_number, unit_room_number, unit_floor_area, unit_status, |
| | 83 | unit_price, unit_image, unit_floorplan, unit_vector_image, floor_id) |
| | 84 | PK: unit_id, FK: floor_id, FD: FD5 |
| | 85 | |
| | 86 | R7_AGENT(agent_id, agent_name, agent_email, agent_phone) |
| | 87 | PK: agent_id, FD: FD6 |
| | 88 | |
| | 89 | R8_TIMESLOT(timeslot_id, timeslot_date, timeslot_time_start, timeslot_time_end, |
| | 90 | timeslot_status, agent_id) |
| | 91 | PK: timeslot_id, FK: agent_id, FD: FD7 |
| | 92 | |
| | 93 | R9_CLIENT(client_id, client_name, client_email, client_phone) |
| | 94 | PK: client_id, Candidate Key: client_email, FD: FD8, FD9 |
| | 95 | |
| | 96 | R10_APPOINTMENT(appointment_id, appointment_status, client_id, unit_id, timeslot_id) |
| | 97 | PK: appointment_id, FK: client_id, unit_id, timeslot_id, FD: FD10 |
| | 98 | }}} |
| | 99 | |
| | 100 | '''Preservation of functional dependencies:''' All FD1-FD10 preserved. |
| | 101 | |
| | 102 | '''Lossless join:''' Foreign keys enable the reconstruction through natural joins. |
| | 103 | |
| | 104 | == 2NF decomposition |
| | 105 | |
| | 106 | '''Relations to analyze:''' R1_ADMIN - R10_APPOINTMENT (All 1NF relations) |
| | 107 | |
| | 108 | '''Analysis:''' |
| | 109 | |
| | 110 | All relations from the 1NF decomposition have single attribute primary keys, only exception is R4_DESIGNS which contains only key attributes. |
| | 111 | |
| | 112 | '''Relation R1_ADMIN:''' |
| | 113 | * Primary Key: admin_id |
| | 114 | * Functional Dependencies: admin_id -> admin_name, admin_email, admin_password |
| | 115 | * Candidate Keys: {admin_id} |
| | 116 | * Normal Form Status: In 2NF |
| | 117 | |
| | 118 | '''Relation R2_BUILDING:''' |
| | 119 | * Primary Key: building_id |
| | 120 | * Functional Dependencies: building_id -> building_name, building_address, building_description, admin_id |
| | 121 | * Candidate Keys: {building_id} |
| | 122 | * Normal Form Status: In 2NF |
| | 123 | |
| | 124 | '''Relation R3_ARCHITECT:''' |
| | 125 | * Primary Key: architect_id |
| | 126 | * Functional Dependencies: architect_id -> architect_full_name, architect_contact_info |
| | 127 | * Candidate Keys: {architect_id} |
| | 128 | * Normal Form Status: In 2NF |
| | 129 | |
| | 130 | '''Relation R4_DESIGNS:''' |
| | 131 | * Primary Key: {building_id, architect_id} |
| | 132 | * Functional Dependencies: None |
| | 133 | * Normal Form Status: In 2NF |
| | 134 | |
| | 135 | '''Relation R5_FLOOR:''' |
| | 136 | * Primary Key: floor_id |
| | 137 | * Functional Dependencies: floor_id -> floor_number, floor_layout_image, building_id |
| | 138 | * Candidate Keys: {floor_id} |
| | 139 | * Normal Form Status: In 2NF |
| | 140 | |
| | 141 | '''Relation R6_UNIT:''' |
| | 142 | * Primary Key: unit_id |
| | 143 | * Functional Dependencies: unit_id -> unit_number, unit_room_number, unit_floor_area, unit_status, unit_price, unit_image, unit_floorplan, unit_vector_image, floor_id |
| | 144 | * Candidate Keys: {unit_id} |
| | 145 | * Normal Form Status: In 2NF |
| | 146 | |
| | 147 | '''Relation R7_AGENT:''' |
| | 148 | * Primary Key: agent_id |
| | 149 | * Functional Dependencies: agent_id -> agent_name, agent_email, agent_phone |
| | 150 | * Candidate Keys: {agent_id} |
| | 151 | * Normal Form Status: In 2NF |
| | 152 | |
| | 153 | '''Relation R8_TIMESLOT:''' |
| | 154 | * Primary Key: timeslot_id |
| | 155 | * Functional Dependencies: timeslot_id -> timeslot_date, timeslot_time_start, timeslot_time_end, timeslot_status, agent_id |
| | 156 | * Candidate Keys: {timeslot_id} |
| | 157 | * Normal Form Status: In 2NF |
| | 158 | |
| | 159 | '''Relation R9_CLIENT:''' |
| | 160 | * Primary Key: client_id |
| | 161 | * Functional Dependencies: client_id -> client_name, client_email, client_phone; client_email -> client_id |
| | 162 | * Candidate Keys: {client_id}, {client_email} |
| | 163 | * Normal Form Status: In 2NF |
| | 164 | |
| | 165 | '''Relation R10_APPOINTMENT:''' |
| | 166 | * Primary Key: appointment_id |
| | 167 | * Functional Dependencies: appointment_id -> appointment_status, client_id, unit_id, timeslot_id |
| | 168 | * Candidate Keys: {appointment_id} |
| | 169 | * Normal Form Status: In 2NF |
| | 170 | |
| | 171 | '''Issues:''' There are no issues, all relations conform to 2NF. |
| | 172 | |
| | 173 | '''Decomposition:''' There is no need for decomposition. |
| | 174 | |
| | 175 | '''Preservation of functional dependencies:''' All FD1-FD10 preserved. |
| | 176 | |
| | 177 | '''Lossless join:''' Foreign keys enable the reconstruction through natural joins. |
| | 178 | |