SQL ALTER TABLE: Adding a Primary Key Constraint
The SQL statement 'ALTER TABLE customer ADD CONSTRAINT pk_id PRIMARY KEY(customer_id)' will add a primary key constraint to the 'customer' table using the 'customer_id' column. This means:
-
A primary key constraint ensures that each row in the table has a unique value for the specified column (in this case, 'customer_id').
-
The 'pk_id' is the name of the constraint.
-
This statement will not add a new column to the table. It will simply add a constraint to an existing column.
Therefore, the correct answer is A.
Incorrect answers:
- B: This statement adds a primary key constraint, not removes it.
- C: This statement does not add a new column, it adds a constraint to an existing column.
- D: The statement has a specific purpose and will add a primary key constraint.
原文地址: https://www.cveoy.top/t/topic/nwRA 著作权归作者所有。请勿转载和采集!