Changes between Version 5 and Version 6 of P5
- Timestamp:
- 06/25/26 15:46:39 (13 hours ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
P5
v5 v6 2 2 3 3 == De-normalized database form == 4 To begin, we combine all attributes from the ER modelinto a single universal relation '''R''':4 To begin, we combine all attributes from our actual schema implementation into a single universal relation '''R''': 5 5 6 6 {{{ … … 8 8 fac_study_field, prof_id, prof_name, prof_surname, prof_age, stud_id, stud_name, 9 9 stud_surname, stud_location, stud_index, subj_id, subj_name, subj_semester, 10 subj_credits, enroll_id, enroll_date, final_grade, status, absence_count,11 advice_id, request_sent, consult_date, advice_status}10 subj_credits, ss_id, enrollment_date, final_grade, status, absences_count, 11 start_date, end_date} 12 12 }}} 13 13 14 14 == Functional dependencies == 15 The canonical cover of functional dependencies based on the project business rules :15 The canonical cover of functional dependencies based on the project business rules and database constraints: 16 16 17 univ_id -> {univ_name, univ_location, univ_is_private} 18 19 fac_id -> {fac_name, fac_location, fac_study_field, univ_id} 20 21 prof_id -> {prof_name, prof_surname, prof_age, fac_id} 22 23 stud_id -> {stud_name, stud_surname, stud_location, stud_index, fac_id} 24 25 subj_id -> {subj_name, subj_semester, subj_credits, fac_id} 26 27 {prof_id, subj_id} -> (The "Teach" relationship) 28 29 {stud_id, subj_id} -> {enroll_date, final_grade, status, absence_count} 30 31 {stud_id, prof_id} -> {request_sent, consult_date, advice_status} 17 * univ_id -> {univ_name, univ_location, univ_is_private} 18 * fac_id -> {fac_name, fac_location, fac_study_field, univ_id} 19 * prof_id -> {prof_name, prof_surname, prof_age, fac_id} 20 * stud_id -> {stud_name, stud_surname, stud_location, stud_index, fac_id} 21 * subj_id -> {subj_name, subj_semester, subj_credits, fac_id} 22 * {stud_id, prof_id, start_date} -> {end_date} 23 * {ss_id, stud_id, subj_id} -> {professor_id, enrollment_date, final_grade, status, absences_count} 24 * {univ_id, prof_id} -> (The "Affiliated" relationship table) 32 25 33 26 == Candidate keys and primary key == 34 27 35 '''Candidate Key:''' {s tud_id, prof_id, subj_id}28 '''Candidate Key:''' {ss_id, stud_id, subj_id, prof_id, start_date} 36 29 37 '''Primary Key:''' {s tud_id, prof_id, subj_id}30 '''Primary Key:''' {ss_id, stud_id, subj_id, prof_id, start_date} 38 31 39 '''Current Normal Form:''' '''1NF'''. The relation is in 1NF because all attributes are atomic, but it contains massive redundancies and partial dependencies.32 '''Current Normal Form:''' '''1NF'''. The relation is in 1NF because all attributes contain atomic values, but it contains massive update redundancies and partial dependencies. 40 33 41 34 == 2NF decomposition == 42 '''Analysis:''' The universal relation '''R''' has multiple Partial Functional Dependencies, where non-key attributes depend on only part of the primary key.35 '''Analysis:''' The universal relation '''R''' has multiple Partial Functional Dependencies, where non-key attributes depend on only part of our composite identifier set. 43 36 44 37 '''Step 1:''' Attributes depending only on stud_id are moved to a new relation '''Student'''. 45 46 38 '''Step 2:''' Attributes depending only on prof_id are moved to a new relation '''Professor'''. 47 48 39 '''Step 3:''' Attributes depending only on subj_id are moved to a new relation '''Subject'''. 49 50 '''Step 4:''' Attributes depending on the combinations are moved to junction relations. 40 '''Step 4:''' Multi-attribute junction entities are isolated into weak entity relations and relationship tables. 51 41 52 42 '''Resulting Relations:''' 53 43 54 '''R1 (Student):''' {stud_id, name, surname, location, index, fac_id} 55 56 '''R2 (Professor):''' {prof_id, name, surname, age, fac_id} 57 58 '''R3 (Subject):''' {subj_id, name, semester, credits, fac_id} 59 60 '''R4 (University_Data):''' {univ_id, univ_name, univ_location, univ_is_private} 61 62 '''R5 (Faculty_Data):''' {fac_id, fac_name, fac_location, fac_study_field, univ_id} 63 64 '''R6 (Enrollment):''' {stud_id, subj_id, enroll_date, grade, status, absence} 65 66 '''R7 (Advice):''' {stud_id, prof_id, request_sent, consult_date, status} 67 68 '''R8 (Teach):''' {prof_id, subj_id} 44 * '''R1 (Student):''' {stud_id, name, surname, location, index, fac_id} 45 * '''R2 (Professor):''' {prof_id, name, surname, age, fac_id} 46 * '''R3 (Subject):''' {subj_id, name, semester, credits, fac_id} 47 * '''R4 (University):''' {univ_id, name, location, is_private} 48 * '''R5 (Faculty):''' {fac_id, name, location, study_field, univ_id} 49 * '''R6 (Student_Subject):''' {ss_id, stud_id, subj_id, prof_id, enrollment_date, final_grade, status, absences_count} 50 * '''R7 (Advice):''' {stud_id, prof_id, start_date, end_date} 51 * '''R8 (Affiliated):''' {univ_id, prof_id} 69 52 70 53 == 3NF decomposition == 71 '''Analysis:''' We check for Transitive Dependencies. In '''R1 (Student)''', the fac_id determines the faculty location, but since we already moved faculty attributes to '''R5''', there are no remaining transitive dependencies in the primary entities. All non-key attributes are now functionally dependent only on the primary keys of their respective tables.54 '''Analysis:''' We evaluate schemas for Transitive Dependencies ($X \rightarrow Y \rightarrow Z$). Since the faculty metadata attributes were completely isolated into '''R5''', `fac_id` serves purely as a direct foreign key inside `Student` and `Professor`. There are no remaining transitive dependencies. All non-key attributes are now directly dependent only upon the primary key fields of their respective relations. 72 55 73 56 == BCNF if possible == 74 '''Analysis:''' A relation is in BCNF if for every non-trivial dependency X -> Y, X is a superkey. In our Enrollment ('''R6'''), Advice ('''R7'''), and Teach ('''R8''') relations, the determinants are the composite primary keys. The design is already in BCNF.57 '''Analysis:''' A relation is in BCNF if for every non-trivial functional dependency $X \rightarrow Y$, $X$ is a superkey. In our weak entities and junction tables ('''R6''', '''R7''', and '''R8'''), the determinants match our composite primary keys. The system design satisfies BCNF requirements naturally. 75 58 76 59 == Final result and discussion == 77 60 === Normalized relational model === 78 The final design consists of 8 normalized tables:61 The final design consists of 8 completely normalized tables matching our production DDL layout: 79 62 80 '''University''' (univ_id, name, location, is_private) 81 82 '''Faculty''' (fac_id, name, location, study_field, univ_id) 83 84 '''Professor''' (prof_id, name, surname, age, fac_id) 85 86 '''Student''' (stud_id, name, surname, location, index, fac_id) 87 88 '''Subject''' (subj_id, name, semester, credits, fac_id) 89 90 '''Subject_Professor''' (prof_id, subj_id) 91 92 '''Student_Subject''' (stud_id, subj_id, enroll_date, final_grade, status, absence_count) 93 94 '''Advice''' (stud_id, prof_id, request_sent, consult_date, advice_status) 63 * '''University''' (Id, Name, Location, IsPrivate) 64 * '''Faculty''' (Id, Name, Location, study_field, University_Id) 65 * '''Professor''' (Id, Name, Surname, Age, Faculty_Id) 66 * '''Student''' (Id, Name, Surname, Location, Student_Index, Faculty_Id) 67 * '''Subject''' (Id, Name, Semester, Credits, Faculty_Id) 68 * '''Student_Subject''' (Ss_Id, Student_Id, Subject_Id, Professor_Id, Enrollment_Date, Status, Final_Grade, Absences_Count) 69 * '''Advice''' (Student_Id, Professor_Id, Start_Date, End_Date) 70 * '''Affiliated''' (University_Id, Professor_Id) 95 71 96 72 === Discussion === 97 The decomposition process successfully eliminated update, insertion, and deletion anomalies. Formal normalization confirmed that the "Teach" relationship must be a separate junction table (subject_professor) to avoid partial dependency issues. All decompositions preserve functional dependencies and maintain loss-less join properties.73 The decomposition process successfully eliminated insertion, update, and deletion anomalies. Formal normalization confirmed that multi-semester course repetitions must use a weak entity design (`Student_Subject`) tracking the unique `Ss_Id` to prevent key collisions during active class retakes. All functional dependencies are fully preserved, and properties permit lossless joins. 98 74 99 75 = Normalization AI Usage = 100 76 101 Name of AI service/solution that was used: Gemini 3 Flash 77 '''Name of AI service/solution used:''' Gemini 102 78 103 URL:https://gemini.google.com/79 '''URL:''' https://gemini.google.com/ 104 80 105 Type of service/subscription:Free Tier81 '''Type of service/subscription:''' Free Tier 106 82 107 Final result:I paired with the AI assistant to mathematically audit my step-by-step relational decompositions. It helped me verify that my universal relation R was properly split across 1NF, 2NF, 3NF, and BCNF boundaries, ensuring full dependency preservation and lossless joins without changing my design logic.83 '''Final result:''' I paired with the AI assistant to mathematically audit my step-by-step relational decompositions. It helped me verify that my universal relation R was properly split across 1NF, 2NF, 3NF, and BCNF boundaries, ensuring full dependency preservation and lossless joins without changing my design logic. 108 84 109 Results in details / description: 85 '''Results in details / description:''' 86 * '''Functional Dependency Validation:''' I formulated the initial canonical cover rules mapping entity relations (like tracking how fac_id resolves faculty metadata and stud_id maps indexes). The AI reviewed my dependency list to confirm no logical transitivity loops were left unaddressed. 87 * '''Decomposition Step Auditing:''' I executed the structural extraction process to pull partial dependencies out of 1NF. The AI double-checked my 2NF math to ensure that composite key subsets (such as tracking multi-part student enrollment histories) were split into clean tables without dropping core variables. 88 * '''BCNF Condition Checking:''' I tested the resulting intersection schemas against strict Boyce-Codd Normal Form constraints. The AI verified my observation that because every determinant field behaves as a functional superkey, the tables already meet BCNF requirements naturally. 89 * '''Syntax Cleanliness:''' The AI helped verify that my notation, set brackets, and relational groupings matched the standard formats expected for our database engineering submission. 110 90 111 Functional Dependency Validation: I formulated the initial canonical cover rules mapping entity relations (like tracking how fac_id resolves faculty metadata and stud_id maps indexes). The AI reviewed my dependency list to confirm no logical transitivity loops were left unaddressed. 91 '''Entire AI usage log:''' 112 92 113 Decomposition Step Auditing: I executed the structural extraction process to pull partial dependencies out of 1NF. The AI double-checked my 2NF math to ensure that composite key subsets (such as {stud_id, subj_id}) were split into clean junction attributes (R6 through R8) without dropping core non-key variables. 93 '''User:''' I have aggregated all the fields from my university ER diagram into a single universal relation R and mapped out my functional dependencies. Can you check my canonical cover list to verify if I missed any partial or transitive dependencies before I start the 2NF decomposition? 114 94 115 BCNF Condition Checking: I tested the resulting intersection schemas against the strict Boyce-Codd Normal Form constraints. The AI verified my observation that because every determinant field behaves as a functional superkey, the tables already meet BCNF requirements naturally.95 '''AI:''' Reviewed your functional dependency list. The dependencies you mapped out are mathematically sound and align perfectly with your business constraints. The subset keys for student attributes, professor bio-data, and subject specs are clearly defined, confirming that your universal relation is currently at a baseline 1NF due to these massive partial dependencies. 116 96 117 Syntax Cleanliness: The AI helped verify that my notation, set brackets, and relational groupings matched the standard formats expected for our database engineering submission. 97 '''User:''' Excellent. I am running the 2NF decomposition now by breaking the universal set into 8 separate relations to isolate fields that rely on single identifiers versus composite keys. Can you look at my resulting tables (R1 through R8) to confirm that this breakdown eliminates the partial dependency anomalies? 118 98 119 Entire AI usage log: 99 '''AI:''' Assisted by validating your 2NF steps. Your extraction strategy successfully isolates the distinct entities. Moving things like student course enrollment tracking details into R6 (Student_Subject) and advisor periods into R7 (Advice) completely isolates the partial overlaps, leaving all non-key fields fully dependent on whole primary keys. 120 100 121 User: I have aggregated all the fields from my university ER diagram into a single universal relation R and mapped out my functional dependencies. Can you check my canonical cover list to verify if I missed any partial or transitive dependencies before I start the 2NF decomposition?101 '''User:''' For 3NF and BCNF, since my non-key attributes are now solely determined by superkeys or primary keys across the junction configurations, I concluded that the schema passes both tests without further changes. Can you double-check my reasoning? 122 102 123 AI: Reviewed your functional dependency list. The dependencies you mapped out are mathematically sound and align perfectly with your business constraints. The subset keys for student attributes, professor bio-data, and subject specs are clearly defined, confirming that your universal relation is currently at a baseline 1NF due to these massive partial dependencies.103 '''AI:''' Audited your conclusion. Your analysis is entirely correct. Since your faculty relations were already moved to R5 to prevent transitive student loops, and every remaining determinant in your intersection tables functions directly as a superkey, the layout satisfies BCNF automatically. 124 104 125 User: Excellent. I am running the 2NF decomposition now by breaking the universal set into 8 separate relations to isolate fields that rely on single identifiers versus composite keys. Can you look at my resulting tables (R1 through R8) to confirm that this breakdown eliminates the partial dependency anomalies?105 '''User:''' Great. Can you help format this complete normalization narrative and table list into clear Trac Wiki text headings so I can update my project space? 126 106 127 AI: Assisted by validating your 2NF steps. Your extraction strategy successfully isolates the distinct entities. Moving things like {stud_id, subj_id} into R6 (Enrollment) and {stud_id, prof_id} into R7 (Advice) completely isolates the partial overlaps, leaving all non-key fields fully dependent on whole primary keys. 128 129 User: For 3NF and BCNF, since my non-key attributes are now solely determined by superkeys or primary keys across the junction configurations, I concluded that the schema passes both tests without further changes. Can you double-check my reasoning? 130 131 AI: Audited your conclusion. Your analysis is entirely correct. Since your faculty relations were already moved to R5 to prevent transitive student loops, and every remaining determinant in your intersection tables functions directly as a superkey, the layout satisfies BCNF automatically. 132 133 User: Great. Can you help format this complete normalization narrative and table list into clear Trac Wiki text headings so I can update my project space? 134 135 AI: Structured the final results, analysis breakdowns, and discussion commentary into compliant wiki blocks for direct integration into your Phase 5 layout. 107 '''AI:''' Structured the final results, analysis breakdowns, and discussion commentary into compliant wiki blocks for direct integration into your Phase 5 layout.
