asked 120k views
9 votes
Identify the correctly constructed ALTER TABLE statement to add a UNIQUE constraint to the column user_number with the constraint name user_number_unique on the table called 'user'.

1 Answer

10 votes

ALTER TABLE user ADD CONSTRAINT user_number_unique UNIQUE (user_number);

Common mistakes with adding the UNIQUE constraint to an existing column include not having ( ) around the column names, omitting the keyword UNIQUE, incorrectly spelling the column name, and not including the constraint name.

answered
User Faabass
by
8.5k points