Changes between Version 21 and Version 22 of Normalization


Ignore:
Timestamp:
07/16/26 07:24:11 (10 days ago)
Author:
235018
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Normalization

    v21 v22  
    219219
    220220||=// 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        ||
     221|| 0012025000001 || 2         || Delivered    || 2025-12-02    || Cash           || 0.04        ||
     222|| 0022025000001 || 1         || Placed Order || 2025-12-01    || Credit Card    || 0.00        ||
     223|| 0022025000002 || 1         || Packaging    || 2025-12-10    || PayPal         || 0.00        ||
     224|| 0012025000002 || 3         || Packaging    || 2025-12-12    || Credit Card    || 0.05        ||
     225|| 0022025000003 || 1         || Placed Order || 2025-12-15    || Credit Card    || 0.02        ||
    226226
    227227
     
    249249==== PERSONAL
    250250
    251 ||=// SSN           =||=// first_name =||=// last_name  =||=// email                           =||=// password =||
     251||=// employee_SSN           =||=// first_name =||=// last_name  =||=// email                           =||=// password =||
    252252|| 1234567890123 || Marko      || Petrovski  || marko@woodcraft.mk        || BuHuhjgholko8u7T76TVYFgfChHBJHVGHh ||
    253253|| 9876543210987 || Antonio    || Trajkovski || antonio@woodcraft.mk      || kgvhjgbJgfHGvHhbhg6777t^%dcGfyR%^G ||
     
    353353indirectly.
    354354
    355 
    356 
    357 
    358 
    359 
    360 
     355Example:
     356
     357||=// employeeSSN =||=// store_ID =||=// store_name =||=// store_address =||
     358
     359If
     360
     361{{{#!c++
     362Primary Key -> Non-key Attribute A
     363Non-key Attribute A -> Non-key Attribute B
     364}}}
     365
     366then Store Name and Store Address should not be stored with Employee records. They belong in the STORE table.
     367
     3683NF removes these remaining redundancies.
     369
     370==== PERSONAL
     371
     372**Primary key: ** employee_SSN
     373
     374||=// employee_SSN    =||=// first_name =||=// last_name  =||=// email             =||=// password =||
     375|| 1234567890123 || Marko      || Petrovski  || marko@woodcraft.mk      || BuHuhjgholko8u7T76TVYFgfChHBJHVGHh ||
     376|| 9876543210987 || Antonio    || Trajkovski || antonio@woodcraft.mk    || kgvhjgbJgfHGvHhbhg6777t^%dcGfyR%^G ||
     377|| 4567891234567 || Sara       || Vaneva     || s.vaneva@foxcrochets.mk || UGUgt&^ghjGFu6tgVfCTYt6VghyT6yvHJg ||
     378
     379==== PERMISSIONS
     380
     381**Primary key: ** employee_SSN
     382
     383**Forgein key: ** employee_SSN -> PERSONAL
     384
     385||=// personal_SSN  =||=//type     =||=// authorization =||
     386|| 1234567890123 || Boss     || Admin         ||
     387|| 9876543210987 || Employee || M.Petrovski   ||
     388|| 4567891234567 || Boss     || Admin         ||
     389
     390
     391==== BOSS
     392
     393**Primary key: ** boss_SSN
     394
     395**Forgein key: ** boss_SSN -> PERSONAL(employee_SSN)
     396
     397||=// boss_SSN      =||
     398|| 1234567890123 ||
     399|| 4567891234567 ||
     400
     401==== EMPLOYEE
     402
     403**Primary key: ** employee_SSN
     404
     405**Forgein key: ** employee_SSN -> PERSONAL
     406
     407||=// employee_SSN  =||=// date_of_hire =||
     408|| 9876543210987 || 2019-09-01   ||
     409
     410==== STORE
     411
     412||=// store_ID =||=// name             =||= date_founded =||=// address                     =||=// email            =||=// rating =||
     413|| 001      || WoodCraft Skopje || 2015-03-12   || st.Ilindenska 45, Skopje    || contact@woodcraft.mk   || 4.6    ||
     414|| 002      || Fox Crochets     || 2023-06-01   || st.Kej Makedonija 12, Ohrid || ohrid@woodcraft.mk     || 4.8    ||
     415
     416==== WORKS_IN_STORE
     417
     418||=// personal_SSN  =||=// store_ID =||
     419|| 1234567890123 || 001      ||
     420|| 9876543210987 || 001      ||
     421|| 4567891234567 || 002      ||
     422
     423==== PRODUCT
     424
     425||= product_code =||=// price =||=// availability =||=// weight =||=// dimensions =||=// production_time =||=// description                =||=// delivery_cost =||
     426|| 00100001     || 700   || 50           || 2.5    || 30×20×10   || 10             || Handmade wooden chair with oak wood     || 50            ||
     427|| 00200001     || 150   || 10           || 0.2    || 20×20×15   || 2              || Heart crochet                           || 0             ||
     428|| 00200002     || 199   || 100          || 0.75   || 40×40×1    || 14             || Decorative wall hanging made with beads || 0             ||
     429
     430==== IMAGE
     431
     432||=// product_code =||=// image          =||
     433|| 00100001     || chair.jpg              ||
     434|| 00200001     || crochet-heart-red.jpg  ||
     435|| 00200001     || crochet-heart-blue.jpg ||
     436|| 00200002     || wall_hanging.jpg       ||
     437
     438
     439==== COLOR
     440
     441||=// product_code =||=// color        =||
     442|| 00100001     || Brown                  ||
     443|| 00200001     || Blue                   ||
     444|| 00200001     || Red                    ||
     445|| 00200001     || Yellow                 ||
     446|| 00200001     || Green                  ||
     447|| 00200002     || White & Pink           ||
     448|| 00200002     || Black & Gold           ||
     449|| 00200002     || Orange, Green & Purple ||
     450
     451
     452==== SELLS
     453
     454||=// store_ID =||=// product_code =||=// discount =||
     455|| 001      || 00100001     || 0        ||
     456|| 002      || 00200001     || 0        ||
     457|| 002      || 00200002     || 0.5      ||
     458
     459
     460==== CLIENT
     461
     462||=// client_ID =||=// first_name =||=// last_name =||=// email                         =||=// password =||
     463|| 1         || Ivan       || Stojanov  || ivan@gmail.com                                   || HLUaguhoBJKbjhVjkgKJkjVHK ||
     464|| 2         || Marija     || Kostova   || marija@yahoo.com               || CHVLKDNVJKnkjbkjbjkVKnkNkjbKJ ||
     465|| 3         || Antoneta   || Mariovska || mariovskaantoneta@finki.ukim.mk  || KHkukUhukGUhIKLjLjgukguhLKhukFkHvbH ||
     466
     467==== DELIVERY ADDRESS
     468
     469||=// client_ID =||=// address                   =||
     470|| 1         || st.Partizanska 10, Skopje ||
     471|| 2         || st.Turisticka 5, Bitola   ||
     472|| 3         || st.32 4, s.Cucer-Sandevo  ||
     473
     474==== ORDER
     475
     476||=// order_num      =||=// client_ID =||=// status       =||=// last_modified =||=// payment_method =||=// discount =||
     477|| 0012025000001 || 2         || Delivered    || 2025-12-02    || Cash           || 0.04        ||
     478|| 0022025000001 || 1         || Placed Order || 2025-12-01    || Credit Card    || 0.00        ||
     479|| 0022025000002 || 1         || Packaging    || 2025-12-10    || PayPal         || 0.00        ||
     480|| 0012025000002 || 3         || Packaging    || 2025-12-12    || Credit Card    || 0.05        ||
     481|| 0022025000003 || 1         || Placed Order || 2025-12-15    || Credit Card    || 0.02        ||
     482
     483
     484==== INCLUDES
     485
     486||=// order_num     =||=// product_code =||
     487|| 0012025000001 || 00100001     ||
     488|| 0022025000001 || 00200002     ||
     489|| 0022025000002 || 00200001     ||
     490|| 0012025000002 || 00100001     ||
     491|| 0012025000002 || 00200001     ||
     492|| 0022025000003 || 00200002     ||
     493
     494
     495==== REVIEW
     496
     497||=//  order_num      =||=// comment             =||=// rating =||=// last_modified =||
     498|| 0012025000001 || Great quality, slightly late delivery || 4      || 2024-12-05    ||
     499|| 0022025000001 || Excellent craftsmanship               || 5      || 2025-12-03    ||
     500|| 0022025000002 || Beautiful handmade product            || 5      || 2025-12-11    ||
     501|| 0012025000002 || Very satisfied                        || 5      || 2025-12-14    ||
     502|| 0022025000003 || Wonderful decoration                  || 5      || 2025-12-20    ||
     503
     504
     505==== REQUEST
     506
     507||=// request_num   =||=// date       =||=// problem            =||=// notes              =||=// satisfaction =||
     508|| 001112025001 || 2024-11-03 || Late delivery      || Discount offered   || 4            ||
     509|| 002122025001 || 2024-12-04 || Military discount  || Approved           || 5            ||
     510|| 003122025001 || 2024-12-10 || Packaging question || Explained shipping || 5            ||
     511|| 004122025001 || 2024-12-16 || Shipping question  || Tracking provided  || 5            ||
     512
     513
     514==== MAKES REQUEST
     515
     516||=// client_ID =||=// request_num   =||
     517|| 2         || 001112025001 ||
     518|| 3         || 002122025001 ||
     519|| 3         || 003122025001 ||
     520|| 1         || 004122025001 ||
     521
     522
     523==== ANSWERS
     524
     525||=// client_ID =||=// request_num   =||
     526|| 2         || 001112025001 ||
     527|| 3         || 002122025001 ||
     528|| 3         || 003122025001 ||
     529|| 1         || 004122025001 ||
     530
     531
     532==== REQUEST_FOR_STORE
     533
     534||=// request_number =||=// store_ID =||
     535|| 001112025001   || 001      ||
     536|| 002122025001   || 002      ||
     537
     538Instead of storing store information inside REQUEST, a relationship table is used.
     539
     540==== REPORT
     541
     542||=// date       =||=// store_ID =||=// overall_profit =||=// sales_trend =||=// marketing_growth =||=// signature   =||
     543|| 2024-11-30 || 001   || 125000         || Increasing  || Stable Growth    || M.Petrovski ||
     544|| 2024-11-30 || 002   || 98000          || Stable      || Moderate Growth  || S.Vaneva    ||
     545
     546
     547==== MONTHLY_PROFIT
     548
     549||=// report_date =||=// store_ID =||=// month    =||=// profit =||
     550|| 2024-11-30  || 001   || Nov 2024 || 12500  ||
     551|| 2024-11-30  || 002   || Nov 2024 || 8000   ||
     552
     553==== WORKED
     554
     555||=// personal_SSN  =||=// report_date =||=// store_ID =||=// wage =||=// pay_method =||=// hours =||=// week      =||
     556|| 1234567890123 || 2025-11-30  || 001   || 75   || Hourly     || 48    || 24–30 Nov ||
     557|| 9876543210987 || 2025-11-30  || 001   || 75   || Hourly     || 38    || 24–30 Nov ||
     558|| 4567891234567 || 2025-11-30  || 002   || 450  || Weekly     || 52    || 24–30 Nov ||
     559
     560==== APPROVES
     561
     562||=// boss_SSN      =||=// report_date =||=// store_ID =||=// signature   =||
     563|| 1234567890123 || 2025-12-01  || 001      || M.Petrovski ||
     564|| 4567891234567 || 2025-12-03  || 002      || S.Vaneva    ||
     565
     566The approval relationship is separated from the report because a report is approved by a boss, and this relationship should not duplicate boss information.
     567
     568==== STORE_MONTHLY_DATA
     569
     570||=// report_date =||=// store_ID =||=// monthly_profit =||=// date       =||=// sales =||=// samages |
     571|| 2024-11-30  || 001      || 38750          || 2024-12-01 || 52    || 750     ||
     572|| 2024-11-30  || 002      || 26150          || 2024-12-01 || 40    || NULL    ||
     573
     574== Explanation: 2NF -> 3NF
     575
     576Although the database satisfied Second Normal Form by eliminating partial dependencies, some transitive dependencies still existed. In Third Normal Form, these remaining dependencies were removed by ensuring that every non-key attribute depends directly and only on the primary key.
     577
     578For example, employee role information was separated from the PERSONAL table into the PERMISSIONS relation, while employee specializations were represented by the BOSS and EMPLOYEE tables. This prevents storing attributes that apply only to certain personnel in every employee record. Likewise, relationships such as WORKS_IN_STORE, APPROVES, FOR_STORE, MAKES_REQUEST, and ANSWERS isolate many-to-many associations into dedicated tables instead of embedding foreign entity information in other relations.
     579
     580The PRODUCT, STORE, CLIENT, and ORDER tables now contain only attributes that describe their own entities. Information about colors, images, delivery addresses, reviews, reports, monthly profits, and request handling is stored in separate relations connected through foreign keys. This design eliminates update, insertion, and deletion anomalies and greatly reduces data redundancy.
     581
     582The resulting schema is fully normalized to Third Normal Form, where each relation represents a single entity or relationship, each non-key attribute depends only on its table's primary key, and all associations between entities are maintained through foreign keys.
     583
     584= Summary of Normalization process
     585
     586||=// Normal Form         =||=// Main Objective        =|| Changes Made        ||
     587|| **Denormalized (UNF)**       || Store all data in one large table                   || Repeating groups and multi-valued attributes exist, leading to redundancy and anomalies.           ||
     588|| **First Normal Form (1NF)**  || Eliminate repeating groups and ensure atomic values || Multi-valued attributes (e.g., colors, images, products in an order) are split into separate rows or relations so that each field contains a single value.                         ||
     589|| **Second Normal Form (2NF)** || Remove partial dependencies                         || Attributes that depend on only part of a composite key are moved to separate tables (e.g., product details, store details). Relationship tables retain only attributes dependent on the full composite key.                        ||
     590|| **Third Normal Form (3NF)**  || Remove transitive dependencies                      || Attributes that depend on other non-key attributes are separated into dedicated relations (e.g., permissions, employee roles, report approvals, request handling), leaving each table to describe a single entity or relationship. ||
     591
     592
     593
     594
     595