Changes between Version 10 and Version 11 of P5


Ignore:
Timestamp:
04/17/26 23:33:14 (2 weeks ago)
Author:
211099
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • P5

    v10 v11  
    7575Every column in the database holds just one value, so there are no lists or multi-value attributes in the cells. There are no repeating columns, each table has a primary key, and all attributes are atomic, so my relations satisfy 1NF.
    7676
     77=== 2NF Decomposition
     78R has the following candidate key:
     79CK = {chapter_id, genre_id, list_id, notification_id, suggestion_id, comment_id, status, content_type, suggestion_type, roles, permission_level}
     80Since CK is composite, we check for partial dependencies:
     81
     82chapter_id → chapter_number, chapter_name, title, chapter_content, word_count, rating, published_at, view_count, story_id, chapter_created_at, chapter_updated_at — partial dependency, violates 2NF
     83genre_id → genre_name — partial dependency, violates 2NF
     84list_id → list_name, list_content, is_public, user_id, list_created_at, list_updated_at — partial dependency, violates 2NF
     85notification_id → notification_content, is_read, type, link, notification_created_at — partial dependency, violates 2NF
     86suggestion_id → original_text, suggested_text, accepted, suggestion_created_at, applied_at, story_id — partial dependency, violates 2NF
     87comment_id → comment_content, user_id, story_id, comment_created_at, comment_updated_at — partial dependency, violates 2NF
     88
    7789=== 2NF Check
    78 Every table that has a simple (non-composite) primary key is already in 2NF, so we only need to check the tables that have composite keys.
     90After decomposition we verify that every resulting relation satisfies 2NF:
    7991
    80 STATUS {story_id, status} → There are no other attributes, so it satisfies 2NF.
    81 
    82 CONTENT_TYPE {notification_id, content_type} → There are no other attributes, so it satisfies 2NF.
    83 
    84 SUGGESTION_TYPE {suggestion_id, suggestion_type} → There are no other attributes, so it satisfies 2NF.
    85 
    86 LIKES {user_id, story_id} → like_created_at depends on {user_id, story_id} together, so it satisfies 2NF.
    87 
    88 COLLABORATION {user_id, story_id} → collab_created_at depends on {user_id, story_id} together, so it satisfies 2NF.
    89 
    90 ROLES {user_id, story_id, roles} → There are no other attributes, so it satisfies 2NF.
    91 
    92 PERMISSION_LEVEL {user_id, story_id, permission_level} → There are no other attributes, so it satisfies 2NF.
    93 
    94 HAS_GENRE {story_id, genre_id} → There are no other attributes, so it satisfies 2NF.
    95 
    96 READING_LIST_ITEMS {list_id, story_id} → added_at depends on {list_id, story_id} together, so it satisfies 2NF.
    97 
    98 NOTIFY {user_id, story_id, notification_id} → There are no other attributes, so it satisfies 2NF.
    99 
    100 NEED_APPROVAL {suggestion_id, story_id, chapter_id} → There are no other attributes, so it satisfies 2NF.
    101 
    102 Since there are no partial dependencies in any of the tables, this schema satisfies 2NF.
     92USERS(user_id, username, email, user_name, surname, password, user_created_at, user_updated_at) → simple primary key user_id, so it satisfies 2NF.
     93STORY(story_id, mature_content, short_description, image, story_content, user_id, story_created_at, story_updated_at) → simple primary key story_id, so it satisfies 2NF.
     94CHAPTER(chapter_id, chapter_number, chapter_name, title, chapter_content, word_count, rating, published_at, view_count, story_id, chapter_created_at, chapter_updated_at) → composite candidate key {story_id, chapter_number} exists, but all other attributes depend on the full key, not a subset. No partial dependencies, so it satisfies 2NF.
     95GENRE(genre_id, genre_name) → simple primary key genre_id, so it satisfies 2NF.
     96READING_LIST(list_id, list_name, list_content, is_public, user_id, list_created_at, list_updated_at) → simple primary key list_id, so it satisfies 2NF.
     97NOTIFICATION(notification_id, notification_content, is_read, type, link, notification_created_at) → simple primary key notification_id, so it satisfies 2NF.
     98AI_SUGGESTION(suggestion_id, original_text, suggested_text, accepted, suggestion_created_at, applied_at, story_id) → simple primary key suggestion_id, so it satisfies 2NF.
     99COMMENT(comment_id, comment_content, user_id, story_id, comment_created_at, comment_updated_at) → simple primary key comment_id, so it satisfies 2NF.
     100STATUS(story_id, status) → There are no other attributes, so it satisfies 2NF.
     101CONTENT_TYPE(notification_id, content_type) → There are no other attributes, so it satisfies 2NF.
     102SUGGESTION_TYPE(suggestion_id, suggestion_type) → There are no other attributes, so it satisfies 2NF.
     103LIKES(user_id, story_id, like_created_at) → like_created_at depends on {user_id, story_id} together, so it satisfies 2NF.
     104COLLABORATION(user_id, story_id, collab_created_at) → collab_created_at depends on {user_id, story_id} together, so it satisfies 2NF.
     105ROLES(user_id, story_id, roles) → There are no other attributes, so it satisfies 2NF.
     106PERMISSION_LEVEL(user_id, story_id, permission_level) → There are no other attributes, so it satisfies 2NF.
     107HAS_GENRE(story_id, genre_id) → There are no other attributes, so it satisfies 2NF.
     108READING_LIST_ITEMS(list_id, story_id, added_at) → added_at depends on {list_id, story_id} together, so it satisfies 2NF.
     109NOTIFY(user_id, story_id, notification_id) → There are no other attributes, so it satisfies 2NF.
     110NEED_APPROVAL(suggestion_id, story_id, chapter_id) → There are no other attributes, so it satisfies 2NF.
     111Since there are no partial dependencies in any of the resulting tables, this schema satisfies 2NF.
    103112
    104113=== 3NF Check