To add a primary key on the STUDENT_ID column in the STUDENTS table, you can use the following statement:
D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
Explanation for each option:
A. ALTER TABLE students ADD PRIMARY KEY student_id;
This option is incorrect because it is missing the CONSTRAINT keyword before PRIMARY KEY.
B. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);
This option is incorrect because it is missing a name for the constraint. A constraint must have a unique name.
C. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;
This option is incorrect because it is missing parentheses around the column name student_id.
D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
This option is correct because it uses the correct syntax to add a constraint with a name (stud_id_pk) on the column student_id as the primary key.
E. ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
This option is incorrect because MODIFY CONSTRAINT is used to modify an existing constraint, not to add a new constraint.
The correct answer is D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id). This option is correct because it adds a primary key constraint with the name stud_id_pk on the column student_id in the STUDENTS table.