| | 144 | |
| | 145 | |
| | 146 | == Second Normal Form (2NF) |
| | 147 | |
| | 148 | |
| | 149 | A relation is in Second Normal Form (2NF) if: |
| | 150 | |
| | 151 | **1.** It is already in First Normal Form (1NF). |
| | 152 | **2.** Every non-key attribute is fully functionally dependent on the whole primary key. |
| | 153 | **3.** There are no partial dependencies. |
| | 154 | |
| | 155 | A partial dependency occurs when part of a composite primary key determines a non-key attribute. |
| | 156 | |
| | 157 | |
| | 158 | ==== CLIENT |
| | 159 | |
| | 160 | ||=// client_ID =||=// first_name =||=// last_name =||=// email =||=// password =|| |
| | 161 | || 1 || Ivan || Stojanov || ivan@gmail.com || HLUaguhoBJKbjhVjkgKJkjVHK || |
| | 162 | || 2 || Marija || Kostova || marija@yahoo.com || CHVLKDNVJKnkjbkjbjkVKnkNkjbKJ || |
| | 163 | || 3 || Antoneta || Mariovska || mariovskaantoneta@finki.ukim.mk || KHkukUhukGUhIKLjLjgukguhLKhukFkHvbH || |
| | 164 | |
| | 165 | ==== DELIVERY ADDRESS |
| | 166 | |
| | 167 | ||=// client_ID =||=// address =|| |
| | 168 | || 1 || st.Partizanska 10, Skopje || |
| | 169 | || 2 || st.Turisticka 5, Bitola || |
| | 170 | || 3 || st.32 4, s.Cucer-Sandevo || |
| | 171 | |
| | 172 | |
| | 173 | ==== STORE |
| | 174 | |
| | 175 | ||=// store_ID =||=// name =||= date_founded =||=// address =||=// email =||=// rating =|| |
| | 176 | || 001 || WoodCraft Skopje || 2015-03-12 || st.Ilindenska 45, Skopje || contact@woodcraft.mk || 4.6 || |
| | 177 | || 002 || Fox Crochets || 2023-06-01 || st.Kej Makedonija 12, Ohrid || ohrid@woodcraft.mk || 4.8 || |
| | 178 | |
| | 179 | |
| | 180 | ==== PRODUCT |
| | 181 | |
| | 182 | ||= product_code =||=// price =||=// availability =||=// weight =||=// dimensions =||=// production_time =||=// description =||=// delivery_cost =|| |
| | 183 | || 00100001 || 700 || 50 || 2.5 || 30×20×10 || 10 || Handmade wooden chair with oak wood || 50 || |
| | 184 | || 00200001 || 150 || 10 || 0.2 || 20×20×15 || 2 || Heart crochet || 0 || |
| | 185 | || 00200002 || 199 || 100 || 0.75 || 40×40×1 || 14 || Decorative wall hanging made with beads || 0 || |
| | 186 | |
| | 187 | |
| | 188 | ==== IMAGE |
| | 189 | |
| | 190 | ||=// product_code =||=// image =|| |
| | 191 | || 00100001 || chair.jpg || |
| | 192 | || 00200001 || crochet-heart-red.jpg || |
| | 193 | || 00200001 || crochet-heart-blue.jpg || |
| | 194 | || 00200002 || wall_hanging.jpg || |
| | 195 | |
| | 196 | |
| | 197 | ==== COLOR |
| | 198 | |
| | 199 | ||=// product_code =||=// color =|| |
| | 200 | || 00100001 || Brown || |
| | 201 | || 00200001 || Blue || |
| | 202 | || 00200001 || Red || |
| | 203 | || 00200001 || Yellow || |
| | 204 | || 00200001 || Green || |
| | 205 | || 00200002 || White & Pink || |
| | 206 | || 00200002 || Black & Gold || |
| | 207 | || 00200002 || Orange, Green & Purple || |
| | 208 | |
| | 209 | |
| | 210 | ==== SELLS |
| | 211 | |
| | 212 | ||=// store_ID =||=// product_code =||=// discount =|| |
| | 213 | || 001 || 00100001 || 0 || |
| | 214 | || 002 || 00200001 || 0 || |
| | 215 | || 002 || 00200002 || 0.5 || |
| | 216 | |
| | 217 | |
| | 218 | ==== ORDER |
| | 219 | |
| | 220 | ||=// order_num =||=// client_ID =||=// status =||=// last_modified =||=// payment_method =||=// discount =|| |
| | 221 | || 0012025000001 || 2 || Delivered || 2025-12-02 || Cash || 4 || |
| | 222 | || 0022025000001 || 1 || Placed Order || 2025-12-01 || Credit Card || 0 || |
| | 223 | || 0022025000002 || 1 || Packaging || 2025-12-10 || PayPal || 0 || |
| | 224 | || 0012025000002 || 3 || Packaging || 2025-12-12 || Credit Card || 5 || |
| | 225 | || 0022025000003 || 1 || Placed Order || 2025-12-15 || Credit Card || 2 || |
| | 226 | |
| | 227 | |
| | 228 | ==== INCLUDES |
| | 229 | |
| | 230 | ||=// order_num =||=// product_code =||=// quantity =|| |
| | 231 | || 0012025000001 || 00100001 || 1 || |
| | 232 | || 0022025000001 || 00200002 || 2 || |
| | 233 | || 0022025000002 || 00200001 || 3 || |
| | 234 | || 0012025000002 || 00100001 || 1 || |
| | 235 | || 0012025000002 || 00200001 || 1 || |
| | 236 | || 0022025000003 || 00200002 || 1 || |
| | 237 | |
| | 238 | |
| | 239 | |
| | 240 | ==== REVIEW |
| | 241 | |
| | 242 | ||=// order_num =||=// comment =||=// rating =||=// last_modified =|| |
| | 243 | || 0012025000001 || Great quality, slightly late delivery || 4 || 2024-12-05 || |
| | 244 | || 0022025000001 || Excellent craftsmanship || 5 || 2025-12-03 || |
| | 245 | || 0022025000002 || Beautiful handmade product || 5 || 2025-12-11 || |
| | 246 | || 0012025000002 || Very satisfied || 5 || 2025-12-14 || |
| | 247 | || 0022025000003 || Wonderful decoration || 5 || 2025-12-20 || |
| | 248 | |
| | 249 | ==== PERSONAL |
| | 250 | |
| | 251 | ||=// SSN =||=// first_name =||=// last_name =||=// email =||=// password =|| |
| | 252 | || 1234567890123 || Marko || Petrovski || marko@woodcraft.mk || BuHuhjgholko8u7T76TVYFgfChHBJHVGHh || |
| | 253 | || 9876543210987 || Antonio || Trajkovski || antonio@woodcraft.mk || kgvhjgbJgfHGvHhbhg6777t^%dcGfyR%^G || |
| | 254 | || 4567891234567 || Sara || Vaneva || s.vaneva@foxcrochets.mk || UGUgt&^ghjGFu6tgVfCTYt6VghyT6yvHJg || |
| | 255 | |
| | 256 | |
| | 257 | ==== PERMISSIONS |
| | 258 | |
| | 259 | ||=// personal_SSN =||=//type =||=// authorization =|| |
| | 260 | || 1234567890123 || Boss || Admin || |
| | 261 | || 9876543210987 || Employee || M.Petrovski || |
| | 262 | || 4567891234567 || Boss || Admin || |
| | 263 | |
| | 264 | ==== WORKS_IN_STORE |
| | 265 | |
| | 266 | ||=// personal_SSN =||=// store_ID =|| |
| | 267 | || 1234567890123 || 001 || |
| | 268 | || 9876543210987 || 001 || |
| | 269 | || 4567891234567 || 002 || |
| | 270 | |
| | 271 | |
| | 272 | ==== WORKED |
| | 273 | |
| | 274 | ||=// personal_SSN =||=// report_date =||=// store_ID =||=// wage =||=// pay_method =||=// hours =||=// week =|| |
| | 275 | || 1234567890123 || 2025-11-30 || 001 || 75 || Hourly || 48 || 24–30 Nov || |
| | 276 | || 9876543210987 || 2025-11-30 || 001 || 75 || Hourly || 38 || 24–30 Nov || |
| | 277 | || 4567891234567 || 2025-11-30 || 002 || 450 || Weekly || 52 || 24–30 Nov || |
| | 278 | |
| | 279 | |
| | 280 | ==== REPORT |
| | 281 | |
| | 282 | ||=// date =||=// store_ID =||=// overall_profit =||=// sales_trend =||=// marketing_growth =||=// signature =|| |
| | 283 | || 2024-11-30 || 001 || 125000 || Increasing || Stable Growth || M.Petrovski || |
| | 284 | || 2024-11-30 || 002 || 98000 || Stable || Moderate Growth || S.Vaneva || |
| | 285 | |
| | 286 | |
| | 287 | ==== MONTHLY_PROFIT |
| | 288 | |
| | 289 | ||=// report_date =||=// store_ID =||=// month =||=// profit =|| |
| | 290 | || 2024-11-30 || 001 || Nov 2024 || 12500 || |
| | 291 | || 2024-11-30 || 002 || Nov 2024 || 8000 || |
| | 292 | |
| | 293 | |
| | 294 | ==== REQUEST |
| | 295 | |
| | 296 | ||=// request_num =||=// date =||=// problem =||=// notes =||=// satisfaction =|| |
| | 297 | || 001112025001 || 2024-11-03 || Late delivery || Discount offered || 4 || |
| | 298 | || 002122025001 || 2024-12-04 || Military discount || Approved || 5 || |
| | 299 | || 003122025001 || 2024-12-10 || Packaging question || Explained shipping || 5 || |
| | 300 | || 004122025001 || 2024-12-16 || Shipping question || Tracking provided || 5 || |
| | 301 | |
| | 302 | |
| | 303 | ==== MAKES REQUEST |
| | 304 | |
| | 305 | ||=// client_ID =||=// request_num =|| |
| | 306 | || 2 || 001112025001 || |
| | 307 | || 3 || 002122025001 || |
| | 308 | || 3 || 003122025001 || |
| | 309 | || 1 || 004122025001 || |
| | 310 | |
| | 311 | |
| | 312 | ==== ANSWERS |
| | 313 | |
| | 314 | ||=// client_ID =||=// request_num =|| |
| | 315 | || 2 || 001112025001 || |
| | 316 | || 3 || 002122025001 || |
| | 317 | || 3 || 003122025001 || |
| | 318 | || 1 || 004122025001 || |
| | 319 | |
| | 320 | |
| | 321 | == Explanation: 1NF -> 2NF |
| | 322 | |
| | 323 | The First Normal Form removed repeating groups by ensuring that each attribute contained only atomic values. However, some relations still contained composite primary keys, creating the possibility of partial dependencies, where non-key attributes depended on only part of the key instead of the entire key. |
| | 324 | |
| | 325 | For example, in the INCLUDES relation, the composite key is (Order_Number, Product_Code). Product attributes such as description, price, weight, and production time depend only on Product_Code, not on the entire composite key. These attributes were therefore moved into the separate PRODUCT table. Similarly, store-specific discounts were placed in the SELLS relation because the discount depends on the combination of a store and a product rather than on either entity alone. |
| | 326 | |
| | 327 | The same principle was applied throughout the schema. Tables such as IMAGE, COLOR, WORKS_IN_STORE, WORKED, MAKES_REQUEST, and ANSWERS contain only attributes that depend on their complete composite keys. As a result, every non-key attribute in every relation is fully functionally dependent on the whole primary key, satisfying the requirements of Second Normal Form. |
| | 328 | |
| | 329 | Despite these improvements, some transitive dependencies still remain. For instance, information such as employee roles and permissions, report approvals, and specialized employee types (Boss and Employee) can still be further separated. Removing these transitive dependencies leads to Third Normal Form (3NF), which will be covered in Part 3. |
| | 330 | |
| | 331 | |
| | 332 | |
| | 333 | |
| | 334 | |
| | 335 | |
| | 336 | |
| | 337 | |
| | 338 | |
| | 339 | |