Multiple choice softskills teamwork

You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?

  1. ALTER TABLE students ADD PRIMARY KEY student_id;

  2. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);

  3. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;

  4. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY

  5. ALTER TABLE studentsMODIFY CONSTRAINT stud_id_pk PRIMARY KEY

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Option D shows correct syntax to add a named primary key constraint to an existing table. The ADD CONSTRAINT clause requires a constraint name (stud_id_pk), the constraint type (PRIMARY KEY), and the column in parentheses. Option A is missing CONSTRAINT keyword and parentheses. Option B is missing the constraint name. Option C has wrong column syntax (no parentheses). Option E uses MODIFY incorrectly.