Database Design Assignment for EduPro
Database Design Assignment for EduPro
The TRC expression to retrieve students with DeptName 'AI' is {S | Students(S) ∧ ∃D(Departments(D) ∧ S.DeptID = D.DeptID ∧ D.DeptName = 'AI')}. This retrieves tuples S from the Students table where there exists a matching tuple D in Departments, indicating the student’s department is 'AI' .
Normalization addresses insertion anomalies by structuring data into logical groupings that make adding new data without unnecessary duplication possible. For instance, it enables adding a new course or student independently in their respective tables. This design prevents entering redundant department and instructor information without the risk of having unmanageable or inconsistent data entries as each record is uniquely identifiable and logically linked .
Normalization reduces redundancy by decomposing a table into smaller tables and defining relationships between them, eliminating duplicate data storage. At BCNF, each non-trivial functional dependency must have a superkey as the determinant, which ensures strict normalization and reduces redundancy by removing transitive dependencies and assuring better data integrity and simpler updates, ensuring more efficient queries .
To find names of students enrolled in 'AI Basics,' use the Selection (σ) and Projection (π) operators: π_StudentName(σ_CourseName=‘AI Basics’(Students ⨝ Courses)), where the natural join (⨝) between Students and Courses relates students with courses they are enrolled in, and σ filters only the tuples with ‘AI Basics’ as CourseName. π projects the StudentName attribute from the selected tuples .
INSERT INTO Students (StudentID, StudentName, Email, DeptID) VALUES ('S4', 'Priya', 'priya@edu.com', 'D1'); This statement adds a new student without assigning a course by inserting into the Students table. Normalization ensures courses and students are managed separately, so missing course assignments don’t violate constraints, allowing flexible yet controlled data management in accordance with separation of concerns .
Improved database design through proper normalization reduces data redundancy and potential inconsistencies, which facilitates efficient queries and maintains data integrity. By structuring data in a way that separates logically distinct entities, joined queries become simpler and faster. It also ensures scalability, easier updates, and compliance with changes, augmenting overall data management efficiency and promoting agility in adapting to future requirements .
The DRC expression { < t.StudentName > | ∃c (Students(t) ∧ Courses(c) ∧ t.CourseID = c.CourseID ∧ c.Instructor = 'Dr. Mehta') } retrieves student names where tuples exist in Courses taught by 'Dr. Mehta'. This allows flexible retrieval based on complex conditions, enabling high-level abstraction and precise query formation for information retrieval .
Insertion anomaly: If a new course is introduced without students enrolled, redundant information about departments and instructors must be entered repeatedly or inaccurately omitted, leading to redundancy and incomplete records. Update anomaly: Modifying an instructor's email for all courses taught by them requires multiple updates across rows, risking inconsistency. Deletion anomaly: Removing the only student enrolled in a course results in loss of course and instructor data, impacting record integrity .
Use an anti-join approach: SELECT StudentName FROM Students LEFT JOIN Enrollments ON Students.StudentID = Enrollments.StudentID WHERE Enrollments.CourseID IS NULL. This query returns students without course enrollments, ensuring no data integrity issues due to records suggesting students exist without valid enrollments, highlighting prospective database anomalies or mismanagements in enrollment processes .
1NF: Ensure atomicity by breaking multi-valued columns. 2NF: Remove partial dependencies by dividing the table based on functional dependencies, ensuring each non-key attribute is fully functionally dependent on the primary key. 3NF: Eliminate transitive dependencies to ensure non-key attributes are directly dependent on primary keys only. BCNF: Resolve any remaining anomalies by ensuring all determinants are superkeys. Primary Keys: Establish unique identifiers for each table (e.g., StudentID, CourseID). Candidate Keys: Identify alternative keys that can uniquely identify a record. Foreign Keys: Define columns that reference candidate keys in other tables to maintain referential integrity .