Composite primary key for enrollment
SQL
Easy
6 views
Problem Description
Create Enrollment(student_id, course_id, enrolled_on). One student can enroll once per course. Make (student_id, course_id) the primary key.
Output Format
DDL statement(s)
Sample Test Case
Input:
Enrollment(student_id, course_id, enrolled_on)
Official Solution
CREATE TABLE Enrollment (student_id INT NOT NULL, course_id INT NOT NULL, enrolled_on DATE NOT NULL, PRIMARY KEY (student_id, course_id));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!