Changes between Version 4 and Version 5 of Normalization


Ignore:
Timestamp:
09/18/25 16:08:26 (7 hours ago)
Author:
226030
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Normalization

    v4 v5  
    22Due to the complexity of the restaurant management system and the large number of attributes tied to different logical responsibilities, it is not feasible to normalize all data in a single relation. Instead, normalization is applied to functional modules individually, based on the logical responsibilities within the system.
    33The system is divided into three major functional domains:
    4 1. Reservation Management – comprising: Reservation, FrontStaff and Customer
     41. Reservation Management – comprising: Reservation, FrontStaff and Customer, Table, FrontStaff_Manage_Reservation
    552. Shifts Management – comprising: Manager, Shift, Assignment, and Employee
    663. Order Management – comprising: Employee, TabOrder, OnlineOrder, Payment, Table, Customer, OrderItem, Product, Inventory, and Category
     
    99
    1010== Reservation Management
    11 ||= user_id =||= email =||= city =||= street =||= phone_number =||= password =||= net_salary =||= gross_salary =||= staffRole_id =||= name =||= stay_length =||= creation_timestamp =||= datetime =||= number_of_people =||= reservation_id =||= customer_id =||= c_email =||= c_street =||= c_city =||= c_phone_num =||= c_password =||
    12 || 1 || test@hotmail.com || Strumica || Mladinska 3 || 70003005 || password1 || 30000 || 40000 || 1 || Server || NULL || 15.7.2025 10:33 || 15.7.2025 20:00 || 4 || 1 || 2 || test2@hotmail.com || Marsal Tito 10 || Strumica || 70001002 || password2 ||
    13 || 1 || test@hotmail.com || Strumica || Mladinska 3 || 70003005 || password1 || 30000 || 40000 || 1 || Server || NULL || 16.7.2025 10:33 || 17.7.2025 20:00 || 6 || 2 || 2 || test2@hotmail.com || Marsal Tito 10 || Strumica || 70001002 || password2 ||
    14 || 5 || test5@hotmail.com || Strumica || Mladinska 12 3 || 70005005 || password1 || 20000 || 37000 || 4 || Hostess || NULL || 18.7.2025 10:33 || 18.7.2025 20:00 || 6 || 3 || 2 || test2@hotmail.com || Marsal Tito 10 || Strumica || 70001002 || password2 ||
    15 || 5 || test5@hotmail.com || Strumica || Mladinska 12 3 || 70005005 || password1 || 20000 || 37000 || 4 || Hostess || NULL || 18.7.2025 10:33 || 18.7.2025 21:00 || 6 || 4 || 3 || test3@hotmail.com || Mladinska 5 || Strumica || 70003003 || password2 ||
    16 
    17 R = {e_id, e_email,e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id, name, stay_length, creation_timestamp, datetime, number_of_people, reservation_id, customer_id, c_email, c_street, c_city, c_phone_number,c_password}
     11||= fs_manage_reservation_id =||= employee_id =||= e_email =||= e_city =||= e_street =||= e_phone_number =||= e_password =||= net_salary =||= gross_salary =||= staffRole_id =||= name =||= stay_length =||= creation_timestamp =||= datetime =||= number_of_people =||= reservation_id =||= customer_id =||= c_email =||= c_street =||= c_city =||= c_phone_num =||= c_password =||= table_number =||= seat_capacity
     12|| 1 || 1 || test@hotmail.com || Strumica || Mladinska 3 || 70003005 || password1 || 30000 || 40000 || 1 || Server || NULL || 15.7.2025 10:33 || 15.7.2025 20:00 || 4 || 1 || 2 || test2@hotmail.com || Marsal Tito 10 || Strumica || 70001002 || password2 || 1 || 4
     13|| 2 || 1 || test@hotmail.com || Strumica || Mladinska 3 || 70003005 || password1 || 30000 || 40000 || 1 || Server || NULL || 16.7.2025 10:33 || 17.7.2025 20:00 || 6 || 2 || 2 || test2@hotmail.com || Marsal Tito 10 || Strumica || 70001002 || password2 || 2 || 8
     14|| 3 || 5 || test5@hotmail.com || Strumica || Mladinska 12 3 || 70005005 || password1 || 20000 || 37000 || 4 || Hostess || NULL || 18.7.2025 10:33 || 18.7.2025 20:00 || 6 || 3 || 2 || test2@hotmail.com || Marsal Tito 10 || Strumica || 70001002 || password2 || 2 || 8
     15|| 4 || 5 || test5@hotmail.com || Strumica || Mladinska 12 3 || 70005005 || password1 || 20000 || 37000 || 4 || Hostess || NULL || 18.7.2025 10:33 || 18.7.2025 21:00 || 6 || 4 || 3 || test3@hotmail.com || Mladinska 5 || Strumica || 70003003 || password2 || 3 || 8
     16
     17R = {fs_manage_reservation_id, employee_id, e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id, name, stay_length, creation_timestamp, datetime, number_of_people, reservation_id, customer_id, c_email, c_street, c_city, c_phone_number, c_password, table_number, seat_capacity}
    1818
    1919Functional Dependencies:
    20 - e_id → e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id
    21 - staffRole_id → name
    22 - reservation_id → e_id, stay_length, creation_timestamp, datetime, number_of_people, customer_id
    23 - customer_id → c_email, c_street, c_city, c_phone_number, c_password
    24 
    25 Left only: reservation_id
    26 
    27 Left and right: e_id, staffRole_id, customer_id
    28 
    29 Right only:   e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, name, stay_length, creation_timestamp, datetime, number_of_people, c_email, c_street, c_city, c_phone_number, c_password
    30 
    31 {reservation_id}* = R => reservation_id is the primary key
     20
     21fs_manage_reservation_id → reservation_id, employee_id, table_number
     22
     23employee_id → e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id
     24
     25staffRole_id → name
     26
     27reservation_id → stay_length, creation_timestamp, datetime, number_of_people, customer_id, table_number
     28
     29customer_id → c_email, c_street, c_city, c_phone_number, c_password
     30
     31table_number → seat_capacity
     32
     33Left only: fs_manage_reservation_id
     34
     35Left and right: employee_id, staffRole_id, customer_id, table_number, reservation_id
     36
     37Right only: e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, name, stay_length, creation_timestamp, datetime, number_of_people, c_email, c_street, c_city, c_phone_number, c_password
     38
     39{fs_manage_reservation_id}* = R => fs_manage_reservation_id is the primary key
    3240
    3341We can see that 1NF and 2NF are satisfied due to having atomic attributes and a single primary key, but BNCF is not satisfied due to transitive dependencies.
    3442
    35 Decomposition:
    36 Step 1: Decompose R by e_id
    37 
    38   {e_id}* = { e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id, name}
    39 
    40   R1 = {e_id, e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id, name}
    41 
    42   R2 = {e_id, stay_length, creation_timestamp, datetime, number_of_people, reservation_id, customer_id, c_email, c_street, c_city, c_phone_number,c_password}
     43Decomposition: Step 1: Decompose R by employee_id
     44
     45{e_id}* = {employee_id, e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id, name}
     46
     47R1 = {employee_id, e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id, name}
     48
     49R2 = {employee_id, fs_manage_reservation_id, stay_length, creation_timestamp, datetime, number_of_people, reservation_id, customer_id, c_email, c_street, c_city, c_phone_number,c_password, table_number, seat_capacity}
    4350
    4451Step 2: Decompose R1 by staffRole_id
    45   {staffRole_id}*= {staffRole_id, name}
    46 
    47   R3 = {staffRole_id, name}
    48 
    49   R4 = {e_id, e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id}
     52
     53{staffRole_id}*= {staffRole_id, name}
     54
     55R3 = {staffRole_id, name}
     56
     57R4 = {employee_id, e_email, e_city, e_street, e_phone_number, e_password, net_salary, gross_salary, tip_precent, staffRole_id}
    5058
    5159Step 3: Decompose R2 by customer_id
    52   {customer_id}* = {c_email, c_street, c_city, c_phone_number, c_password} 
    53 
    54   R5 = {customer_id, c_email, c_street, c_city, c_phone_number, c_password}
    55 
    56   R6 = {reservation_id, e_id, stay_length, creation_timestamp, datetime, number_of_people, customer_id}
     60
     61{customer_id}* = {customer_id, c_email, c_street, c_city, c_phone_number, c_password}
     62
     63R5 = {customer_id, c_email, c_street, c_city, c_phone_number, c_password}
     64
     65R6 = {fs_manage_reservation_id, reservation_id, employee_id, stay_length, creation_timestamp, datetime, number_of_people, customer_id, table_number, seat_capacity}
     66
     67Step 4: Decompose R6 by table_number
     68
     69{table_number}* = {table_number, seat_capacity}
     70
     71R7 = {fs_manage_reservation_id, reservation_id, employee_id, stay_length, creation_timestamp, datetime, number_of_people, customer_id, table_number}
     72
     73R8 = {table_number, seat_capacity}
     74
     75Step 5: Decompose R7 by reservation_id
     76
     77{reservation_id}* = {reservation_id, stay_length, creation_timestamp, datetime, number_of_people, customer_id}
     78
     79R9 = {fs_manage_reservation_id, reservation_id, employee_id, table_number}
     80
     81R10 = {reservation_id, stay_length, creation_timestamp, datetime, number_of_people, customer_id}
    5782
    5883Final BCNF Relations:
    59 - R3(StaffRole), R4(FrontStaff), R5(Customer), R6(Reservation)
     84
     85R3(StaffRole), R4(FrontStaff), R5(Customer), R10(Reservation), R8(Table) R9 (FrontStaff_Managed_reservation)
    6086
    6187== Shift Management
     
    132158From our analysis we will try {oi_id, p_id} as a candidate key:
    133159
    134 {oi_id, p_id}+= { oi_timestamp, oi_is_processed, oi_price, pr_id, order_id, oi_quantity, pr_description, tax_class, pr_price, pr_name, manage_inventory, i_quantity, i_restock_level, ca_id, ca_name, ca_is_available, -> p_timestamp, payment_type, amount, tip_amount, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
     160{oi_id, p_id}*= {oi_id, p_id, oi_timestamp, oi_is_processed, oi_price, pr_id, order_id, oi_quantity, pr_description, tax_class, pr_price, pr_name, manage_inventory, i_quantity, i_restock_level, ca_id, ca_name, ca_is_available,p_timestamp, payment_type, amount, tip_amount, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
    135161
    136162{oi_id, p_id} is the only candidate key and primary key.
     
    142168p_id -> p_timestamp, payment_type, amount, tip_amount, order_id
    143169
    144 {p_id}+= {p_id, p_timestamp, payment_type, amount, tip_amount, order_id, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
     170{p_id}*= {p_id, p_timestamp, payment_type, amount, tip_amount, order_id, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
    145171
    146172Step 1: Decompose R by p_id
     
    160186  R1 is not in BCNF because of transitive dependencies
    161187
    162   {order_id}+ = {order_id, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
     188  {order_id}* = {order_id, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
    163189
    164190  R3 = {order_id, employee_id, o_timestamp, o_status, table_number, delivery_address, customer_id, seat_capacity}
     
    172198  table_number -> seat_capacity
    173199
    174   {table_number}+ = {table_number, seat_capacity}
     200  {table_number}* = {table_number, seat_capacity}
    175201
    176202  R5 = {table_number, seat_capacity}
     
    188214  ca_id -> ca_name, ca_is_available
    189215
    190   {pr_id}+ = {pr_id, pr_description, tax_class, pr_price, pr_name, manage_inventory, i_quantity, i_restock_level, ca_id}
     216  {pr_id}* = {pr_id, pr_description, tax_class, pr_price, pr_name, manage_inventory, i_quantity, i_restock_level, ca_id}
    191217
    192218  R7 = {pr_id, pr_description, tax_class, pr_price, pr_name, manage_inventory, i_quantity, i_restock_level, ca_id, ca_name, ca_is_available}
     
    203229  ca_id -> ca_name, ca_is_available
    204230
    205   {ca_id}+ = {ca_id, ca_name, ca_is_available}
     231  {ca_id}* = {ca_id, ca_name, ca_is_available}
    206232
    207233  R9 = {ca_id, ca_name, ca_is_available}