0% found this document useful (0 votes)
12 views2 pages

Database Design Assignment for EduPro

Uploaded by

pgbn25sarthakg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Database Design Assignment for EduPro

Uploaded by

pgbn25sarthakg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Take-Home Assignment 2

Mode: Individual Submission

Deadline: 3rd September

Deliverables: Word file

Instructions

1. This is an individual assignment. Collaboration or group work is not permitted.


2. Ensure clarity, precision, and conciseness in your answers. Proofread your work before
submission.
4. Cite examples where necessary and ensure originality. Plagiarism will result in penalties.
5. Submit your assignment by the deadline on Google Classroom.

Case Background
You are a Database Consultant hired by a growing EdTech startup, EduPro, which manages
online courses, instructors, and student enrollments. The company has been facing
challenges with their database design leading to redundancy, inconsistent data, and
difficulty in querying. They have approached you to help redesign and query their system.
The startup currently stores information in a single table:

Studen StudentN Email Cours CourseN Instruc InstructorE Dept DeptNa HOD
tID ame eID ame tor mail ID me
S1 Aditi aditi@edu. C1 Database Dr. Rao rao@[Link] D1 CS Prof.
com m Shar
ma
S2 Rahul rahul@edu. C2 AI Basics Dr. mehta@edu D2 AI Prof.
com Mehta .com Singh
S3 Aditi aditi@edu. C2 AI Basics Dr. mehta@edu D2 AI Prof.
com Mehta .com Singh

Your Tasks

Task 1 – Identify Problems


a) Highlight at least two anomalies (insertion, update, deletion) in this design.
b) Suggest why this design leads to redundancy.
Task 2 – Normalization Activity
a) Normalize the table step by step into 1NF → 2NF → 3NF → BCNF. Show the resulting
relations at each step.
b) Identify Primary Keys, Candidate Keys, and Foreign Keys in the final design.

Task 3 – Relational Algebra Application


Using your normalized schema, write Relational Algebra expressions for:
1. Find names of students enrolled in “AI Basics.”
2. List all instructors in the “CS” department.
3. Get unique student names (remove duplicates).

Task 4 – Relational Calculus


Express the following using Tuple Relational Calculus (TRC) and Domain Relational Calculus
(DRC):
1. Retrieve all students with DeptName = “AI.”
2. Find the names of students taught by “Dr. Mehta.”

Task 5 – SQL Implementation


Based on your final schema, write SQL queries for:
1. Find all students enrolled in the “Database” course.
2. List students who are not enrolled in any course (anti-join logic).
3. Retrieve departments where no student has enrolled yet.
4. Insert a new student without assigning a course (show how normalization fixes the
insertion anomaly).

Common questions

Powered by AI

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 .

You might also like