Changes between Version 19 and Version 20 of Normalization


Ignore:
Timestamp:
09/15/26 12:20:53 (12 days ago)
Author:
232012
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Normalization

    v19 v20  
    8181
    8282{{{#!div style="text-align: justify; width: 100%;"
    83 **LHS only:**\\
    84 artist_id, song_id, product_id, order_id, modification_id, album_id
    85 
    86 **RHS only:**\\
    87 email, username, password, date_created, shipping_address, telephone_number, admin_type, discount_percentage, points_collected, artist_name, artist_description, artist_photo, title, record_label, genre, release_date, cover_photo, duration, song_name, song_duration, format, price, product_description, stock, payment_method, purchase_date, points_earned, points_used, status, date_modified, type_of_modification, discount, price_at_purchase, quantity, release_ordinal, type, added_at, song_ordinal
    88 
    89 **Both LHS and RHS:**\\
    90 user_id, wishlist_id, release_id
     83**LHS only:**
     84
     85artist_id, song_id, product_id, order_id, modification_id
     86
     87**RHS only:**
     88
     89password, date_created, shipping_address, telephone_number, admin_type, discount_percentage, points_collected, artist_name, artist_description, artist_photo, title, record_label, genre, release_date, cover_photo, duration, song_name, song_duration, format, price, product_description, stock,
     90payment_method, purchase_date, points_earned, points_used, status, date_modified, type_of_modification, discount, price_at_purchase, quantity,
     91release_ordinal, type, added_at, song_ordinal
     92
     93**Both LHS and RHS:**
     94
     95user_id, email, username, admin_id, wishlist_id, release_id
     96
     97**Neither LHS nor RHS:**
     98
     99album_id
    91100}}}
    92101
    … …  
    94103
    95104{{{#!div style="text-align: justify; width: 100%;"
    96 When identifying a candidate key, we first consider the attributes that appear only on the left-hand side (LHS) of the functional dependencies:
    97 
    98 **{artist_id, song_id, product_id, order_id,modification_id, album_id}**
    99 
    100 These attributes cannot be derived from any other attributes using the given functional dependencies, so they must be included in a candidate key.
    101 
    102 Therefore, we initially define:
     105
     106When identifying a candidate key, we first consider the attributes that cannot be derived from other attributes using the given functional dependencies.
     107
     108The attributes that must be included are:
     109
     110**{artist_id, song_id, product_id, order_id, modification_id, album_id}**
     111
     112`album_id` is included because it does not appear on the right-hand side of any functional dependency, meaning that it cannot be derived from any other attribute.
     113
     114Therefore, we define:
    103115
    104116**K = {order_id, product_id, artist_id, song_id, modification_id, album_id}**
    105117
    106 The closure K+ contains all attributes of the universal relation R. Therefore, K is a superkey.  Each attribute in K is necessary because removing any one of them prevents at least one set of attributes of R from being derived. Therefore, K is minimal and the selected primary key for the initial de-normalized relation is:
    107 
    108 **(order_id, product_id, artist_id, song_id, modification_id, album_id)**
     118To verify that K is a superkey, we calculate its closure.
     119
     120We start with:
     121
     122**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id}**
     123
     124Using:
     125
     126`order_id → user_id, payment_method, purchase_date, points_earned, points_used, status`
     127
     128we obtain:
     129
     130**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status}**
     131
     132Using:
     133
     134`user_id → email, username, password, date_created, shipping_address, telephone_number`
     135
     136we obtain:
     137
     138**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number}**
     139
     140Using:
     141
     142`user_id → points_collected`
     143
     144and:
     145
     146`user_id → wishlist_id`
     147
     148we obtain:
     149
     150**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id}**
     151
     152Using:
     153
     154`product_id → release_id, format, price, product_description, stock`
     155
     156we obtain:
     157
     158**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock}**
     159
     160Using:
     161
     162`release_id → title, record_label, genre, release_date, cover_photo, duration`
     163
     164we obtain:
     165
     166**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration}**
     167
     168Using:
     169
     170`artist_id → artist_name, artist_description, artist_photo`
     171
     172we obtain:
     173
     174**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo}**
     175
     176Using:
     177
     178`song_id → song_name, song_duration`
     179
     180we obtain:
     181
     182**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration}**
     183
     184Using:
     185
     186`modification_id → admin_id, date_modified, type_of_modification, discount`
     187
     188we obtain:
     189
     190**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration, admin_id, date_modified, type_of_modification, discount}**
     191
     192Using the corrected dependency:
     193
     194`admin_id → admin_type, discount_percentage`
     195
     196we obtain:
     197
     198**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration, admin_id, date_modified, type_of_modification, discount, admin_type, discount_percentage}**
     199
     200Since both `order_id` and `product_id` are now present, using:
     201
     202`(order_id, product_id) → price_at_purchase, quantity`
     203
     204we obtain:
     205
     206**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration, admin_id, date_modified, type_of_modification, discount, admin_type, discount_percentage, price_at_purchase, quantity}**
     207
     208Using:
     209
     210`(wishlist_id, product_id) → added_at`
     211
     212we obtain:
     213
     214**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration, admin_id, date_modified, type_of_modification, discount, admin_type, discount_percentage, price_at_purchase, quantity, added_at}**
     215
     216Using:
     217
     218`(release_id, artist_id) → release_ordinal, type`
     219
     220we obtain:
     221
     222**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration, admin_id, date_modified, type_of_modification, discount, admin_type, discount_percentage, price_at_purchase, quantity, added_at, release_ordinal, type}**
     223
     224Using:
     225
     226`(song_id, artist_id) → song_ordinal`
     227
     228we obtain:
     229
     230**K+ = {order_id, product_id, artist_id, song_id, modification_id, album_id, user_id, payment_method, purchase_date, points_earned, points_used, status, email, username, password, date_created, shipping_address, telephone_number, points_collected, wishlist_id, release_id, format, price, product_description, stock, title, record_label, genre, release_date, cover_photo, duration, artist_name, artist_description, artist_photo, song_name, song_duration, admin_id, date_modified, type_of_modification, discount, admin_type, discount_percentage, price_at_purchase, quantity, added_at, release_ordinal, type, song_ordinal}**
     231
     232Therefore:
     233
     234**K+ = R**, so K is a superkey.
     235
     236Therefore, under the current set of functional dependencies:
     237
     238**K = {order_id, product_id, artist_id, song_id, modification_id, album_id}**
     239
     240is a candidate key of the universal relation R.
     241
    109242}}}
    110243