Bird
0
0

You have this table:

medium📝 Debug Q14 of 15
SQL - Database Design and Normalization
You have this table:
CREATE TABLE Enrollment (StudentID INT, CourseID INT, StudentName VARCHAR(50), CourseName VARCHAR(50), PRIMARY KEY (StudentID, CourseID));
Which change fixes the 2NF violation?
AKeep the table as is; 2NF is not violated.
BAdd StudentName and CourseName as part of the primary key.
CRemove the composite key and use a single primary key.
DSplit into three tables: Students(StudentID, StudentName), Courses(CourseID, CourseName), and Enrollment(StudentID, CourseID).
Step-by-Step Solution
Solution:
  1. Step 1: Identify 2NF violation

    StudentName depends only on StudentID, CourseName only on CourseID, causing partial dependencies.
  2. Step 2: Fix by splitting tables

    Splitting into Students(StudentID, StudentName), Courses(CourseID, CourseName), and Enrollment(StudentID, CourseID) removes partial dependencies, achieving 2NF.
  3. Final Answer:

    Split into three tables: Students(StudentID, StudentName), Courses(CourseID, CourseName), and Enrollment(StudentID, CourseID). -> Option D
  4. Quick Check:

    Split tables to remove partial dependencies [OK]
Quick Trick: Split tables to fix partial dependencies [OK]
Common Mistakes:
  • Adding non-key columns to primary key
  • Removing composite key incorrectly
  • Ignoring partial dependencies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes