| | 77 | === 2NF Decomposition |
| | 78 | R has the following candidate key: |
| | 79 | CK = {chapter_id, genre_id, list_id, notification_id, suggestion_id, comment_id, status, content_type, suggestion_type, roles, permission_level} |
| | 80 | Since CK is composite, we check for partial dependencies: |
| | 81 | |
| | 82 | chapter_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 |
| | 83 | genre_id → genre_name — partial dependency, violates 2NF |
| | 84 | list_id → list_name, list_content, is_public, user_id, list_created_at, list_updated_at — partial dependency, violates 2NF |
| | 85 | notification_id → notification_content, is_read, type, link, notification_created_at — partial dependency, violates 2NF |
| | 86 | suggestion_id → original_text, suggested_text, accepted, suggestion_created_at, applied_at, story_id — partial dependency, violates 2NF |
| | 87 | comment_id → comment_content, user_id, story_id, comment_created_at, comment_updated_at — partial dependency, violates 2NF |
| | 88 | |
| 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. |
| | 92 | USERS(user_id, username, email, user_name, surname, password, user_created_at, user_updated_at) → simple primary key user_id, so it satisfies 2NF. |
| | 93 | STORY(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. |
| | 94 | CHAPTER(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. |
| | 95 | GENRE(genre_id, genre_name) → simple primary key genre_id, so it satisfies 2NF. |
| | 96 | READING_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. |
| | 97 | NOTIFICATION(notification_id, notification_content, is_read, type, link, notification_created_at) → simple primary key notification_id, so it satisfies 2NF. |
| | 98 | AI_SUGGESTION(suggestion_id, original_text, suggested_text, accepted, suggestion_created_at, applied_at, story_id) → simple primary key suggestion_id, so it satisfies 2NF. |
| | 99 | COMMENT(comment_id, comment_content, user_id, story_id, comment_created_at, comment_updated_at) → simple primary key comment_id, so it satisfies 2NF. |
| | 100 | STATUS(story_id, status) → There are no other attributes, so it satisfies 2NF. |
| | 101 | CONTENT_TYPE(notification_id, content_type) → There are no other attributes, so it satisfies 2NF. |
| | 102 | SUGGESTION_TYPE(suggestion_id, suggestion_type) → There are no other attributes, so it satisfies 2NF. |
| | 103 | LIKES(user_id, story_id, like_created_at) → like_created_at depends on {user_id, story_id} together, so it satisfies 2NF. |
| | 104 | COLLABORATION(user_id, story_id, collab_created_at) → collab_created_at depends on {user_id, story_id} together, so it satisfies 2NF. |
| | 105 | ROLES(user_id, story_id, roles) → There are no other attributes, so it satisfies 2NF. |
| | 106 | PERMISSION_LEVEL(user_id, story_id, permission_level) → There are no other attributes, so it satisfies 2NF. |
| | 107 | HAS_GENRE(story_id, genre_id) → There are no other attributes, so it satisfies 2NF. |
| | 108 | READING_LIST_ITEMS(list_id, story_id, added_at) → added_at depends on {list_id, story_id} together, so it satisfies 2NF. |
| | 109 | NOTIFY(user_id, story_id, notification_id) → There are no other attributes, so it satisfies 2NF. |
| | 110 | NEED_APPROVAL(suggestion_id, story_id, chapter_id) → There are no other attributes, so it satisfies 2NF. |
| | 111 | Since there are no partial dependencies in any of the resulting tables, this schema satisfies 2NF. |