| | 493 | |
| | 494 | == Final Normalized Design |
| | 495 | |
| | 496 | {{{#!div style="text-align: justify; width: 100%;" |
| | 497 | After completing the normalization process from 1NF through 2NF and 3NF to BCNF, the following relations represent the final normalized relational design. All resulting relations satisfy BCNF, and no further decomposition is required. |
| | 498 | |
| | 499 | {{{ |
| | 500 | USERS( |
| | 501 | user_id PK, |
| | 502 | email UNIQUE, |
| | 503 | username UNIQUE, |
| | 504 | password, |
| | 505 | date_created, |
| | 506 | shipping_address, |
| | 507 | telephone_number |
| | 508 | ) |
| | 509 | |
| | 510 | ADMINS( |
| | 511 | user_id PK, FK → USERS, |
| | 512 | admin_type, |
| | 513 | discount_percentage |
| | 514 | ) |
| | 515 | |
| | 516 | CONSUMERS( |
| | 517 | user_id PK, FK → USERS, |
| | 518 | points_collected |
| | 519 | ) |
| | 520 | |
| | 521 | ARTISTS( |
| | 522 | artist_id PK, |
| | 523 | artist_name, |
| | 524 | artist_description, |
| | 525 | artist_photo |
| | 526 | ) |
| | 527 | |
| | 528 | RELEASES( |
| | 529 | release_id PK, |
| | 530 | title, |
| | 531 | record_label, |
| | 532 | genre, |
| | 533 | release_date, |
| | 534 | cover_photo |
| | 535 | ) |
| | 536 | |
| | 537 | ALBUMS( |
| | 538 | release_id PK, FK → RELEASES |
| | 539 | ) |
| | 540 | |
| | 541 | SINGLE_RELEASES( |
| | 542 | release_id PK, FK → RELEASES, |
| | 543 | duration |
| | 544 | ) |
| | 545 | |
| | 546 | SONGS( |
| | 547 | song_id PK, |
| | 548 | song_name, |
| | 549 | song_duration |
| | 550 | ) |
| | 551 | |
| | 552 | PRODUCTS( |
| | 553 | product_id PK, |
| | 554 | release_id FK → RELEASES, |
| | 555 | format, |
| | 556 | price, |
| | 557 | product_description, |
| | 558 | stock |
| | 559 | ) |
| | 560 | |
| | 561 | ORDERS( |
| | 562 | order_id PK, |
| | 563 | user_id FK → USERS, |
| | 564 | payment_method, |
| | 565 | purchase_date, |
| | 566 | points_earned, |
| | 567 | points_used, |
| | 568 | status |
| | 569 | ) |
| | 570 | |
| | 571 | MODIFICATIONS( |
| | 572 | modification_id PK, |
| | 573 | admin_id FK → ADMINS(user_id), |
| | 574 | date_modified, |
| | 575 | type_of_modification, |
| | 576 | discount |
| | 577 | ) |
| | 578 | |
| | 579 | WISHLISTS( |
| | 580 | wishlist_id PK, |
| | 581 | user_id FK → USERS, UNIQUE |
| | 582 | ) |
| | 583 | |
| | 584 | ORDER_PRODUCTS( |
| | 585 | order_id PK, FK → ORDERS, |
| | 586 | product_id PK, FK → PRODUCTS, |
| | 587 | price_at_purchase, |
| | 588 | quantity |
| | 589 | ) |
| | 590 | |
| | 591 | WISHLIST_PRODUCTS( |
| | 592 | wishlist_id PK, FK → WISHLISTS, |
| | 593 | product_id PK, FK → PRODUCTS, |
| | 594 | added_at |
| | 595 | ) |
| | 596 | |
| | 597 | ALBUM_SONGS( |
| | 598 | album_id PK, FK → ALBUMS(release_id), |
| | 599 | song_id PK, FK → SONGS |
| | 600 | ) |
| | 601 | |
| | 602 | RELEASE_ARTISTS( |
| | 603 | release_id PK, FK → RELEASES, |
| | 604 | artist_id PK, FK → ARTISTS, |
| | 605 | release_ordinal, |
| | 606 | release_artist_type |
| | 607 | ) |
| | 608 | |
| | 609 | SONG_ARTISTS( |
| | 610 | song_id PK, FK → SONGS, |
| | 611 | artist_id PK, FK → ARTISTS, |
| | 612 | song_ordinal |
| | 613 | ) |
| | 614 | |
| | 615 | MODIFICATION_PRODUCTS( |
| | 616 | modification_id PK, FK → MODIFICATIONS, |
| | 617 | product_id PK, FK → PRODUCTS |
| | 618 | ) |
| | 619 | }}} |
| | 620 | |
| | 621 | }}} |
| | 622 | |
| | 623 | == Conclusion |
| | 624 | |
| | 625 | {{{#!div style="text-align: justify; width: 100%;" |
| | 626 | The final normalized design is very similar to the relational design created in Phase 2. Most of the relations obtained during normalization, such as ''USERS'', ''ARTISTS'', ''SONGS'', ''PRODUCTS'', ''ORDERS'', ''MODIFICATIONS'', and ''WISHLISTS'', already exist in the Phase 2 design. The same is true for the subtype relations ''ADMINS'' and ''CONSUMERS'' and the main many-to-many relations. |
| | 627 | |
| | 628 | Some relations, such as ''ALBUM_SONGS'' and ''MODIFICATION_PRODUCTS'', were not directly produced by the functional dependencies because they only contain their key attributes. However, they are kept because they represent important many-to-many relationships in the database. |
| | 629 | |
| | 630 | There is also a difference in the handling of releases. During normalization, {{{duration}}} was considered dependent on {{{release_id}}}, while the Phase 2 design stores it only in ''SINGLE_RELEASES''. The Phase 2 structure with ''RELEASES'', ''ALBUMS'', and ''SINGLE_RELEASES'' is kept because it better represents the meaning of the data. Additionally, there is no point in storing the overall length of the album release if it can be calculated by adding up the length of each of its songs. |
| | 631 | |
| | 632 | The residual relation R15 is also not included as a physical table. It was useful for the theoretical normalization process, but its six attributes do not represent one meaningful relationship in the actual database. |
| | 633 | |
| | 634 | Overall, the normalization process confirms that the Phase 2 design is already well normalized. Therefore, the Phase 2 relational design will be kept for the following phases, and no major restructuring of the database is required. |
| | 635 | }}} |