| | 67 | ====== Lossless join test |
| | 68 | |
| | 69 | R: |
| | 70 | ||= //user_id =||= //user_name =||= //email =||= //password =||= //transaction_account_id =||= //account_name =||= //balance =||= //transaction_id =||= //transaction_name =||= //amount =||= //net_amount =||= //date =||= //transaction_breakdown_id =||= //spent_amount =||= //earned_amount =||= //tag_id =||= //tag_name =|| |
| | 71 | R1: |
| | 72 | ||= //user_id =||= //user_name =||= //email =||= //password =|| |
| | 73 | |
| | 74 | R ∩ R1 = { user_id, user_name, email, password } |
| | 75 | |
| | 76 | user_id → R1 |
| | 77 | |
| | 78 | R ∩ R1 → R1 |
| | 79 | |
| | 80 | ⇒ Декомпозицијата е lossless |
| | 81 | |
| | 82 | R1.1 = R - { user_name, email, password } |
| | 83 | |
| | 94 | ====== Lossless join test |
| | 95 | |
| | 96 | R1.1: |
| | 97 | ||= //user_id =||= //transaction_account_id =||= //account_name =||= //balance =||= //transaction_id =||= //transaction_name =||= //amount =||= //net_amount =||= //date =||= //transaction_breakdown_id =||= //spent_amount =||= //earned_amount =||= //tag_id =||= //tag_name =|| |
| | 98 | R2: |
| | 99 | ||= //transaction_account_id =||= //account_name =||= //balance =||= //user_id || |
| | 100 | |
| | 101 | R1.1 ∩ R2 = { transaction_account_id, account_name, balance, user_id } |
| | 102 | |
| | 103 | transaction_account_id → R |
| | 104 | |
| | 105 | R1.1 ∩ R2 → R2 |
| | 106 | |
| | 107 | ⇒ Декомпозицијата е lossless |
| | 108 | |
| | 109 | R2.1 = R1.1 - { account_name, balance, user_id } |
| | 110 | |
| | 123 | ====== Lossless join test |
| | 124 | |
| | 125 | R2.1: |
| | 126 | ||= //transaction_account_id =||= //transaction_id =||= //transaction_name =||= //amount =||= //net_amount =||= //date =||= //transaction_breakdown_id =||= //spent_amount =||= //earned_amount =||= //tag_id =||= //tag_name =|| |
| | 127 | R3: |
| | 128 | ||= //transaction_id =||= //transaction_name =||= //amount =||= //net_amount =||= //date =||= //tag_id =||= //tag_name =|| |
| | 129 | |
| | 130 | R2.1 ∩ R3 = { transaction_id, transaction_name, amount, net_amount, date, tag_id, tag_name } |
| | 131 | |
| | 132 | transaction_id → R3 |
| | 133 | |
| | 134 | R2.1 ∩ R3 → R3 |
| | 135 | |
| | 136 | ⇒ Декомпозицијата е lossless |
| | 137 | |
| | 138 | R3.1 = R2.1 - { transaction_name, amount, net_amount, date, tag_id, tag_name } |
| | 139 | |
| | 149 | |
| | 150 | ====== Lossless join test |
| | 151 | |
| | 152 | R3.1: |
| | 153 | ||= //transaction_account_id =||= //transaction_id =||= //transaction_breakdown_id =||= //spent_amount =||= //earned_amount =|| |
| | 154 | R4: |
| | 155 | ||= //transaction_breakdown_id =||= //transaction_id =||= //transaction_account_id =||= //spent_amount =||= //earned_amount =|| |
| | 156 | |
| | 157 | R3.1 ∩ R4 = { transaction_breakdown_id, transaction_id, transaction_account_id, spent_amount, earned_amount } |
| | 158 | |
| | 159 | transaction_breakdown_id → R4 |
| | 160 | |
| | 161 | R3.1 ∩ R4 → R4 |
| | 162 | |
| | 163 | ⇒ Декомпозицијата е lossless |
| | 164 | |
| | 165 | R4.1 = R3.1 - { transaction_breakdown_id, transaction_id, transaction_account_id, spent_amount, earned_amount } |
| | 166 | R4.1 = ∅ |