Reputation: 644
I want to add the unique constarint I am using the following query but it gives me an error of SQL syntax
ALTER TABLE user_device ADD CONSTRAINT UKnfrn6f2pu3tqcwhqen0d6cq7u
(owner
,push_notification_id
);
where is the mistake :| it highlighted the mistake in push_notification_id
Upvotes: 0
Views: 2123
Reputation: 1970
Do Like this.
ALTER TABLE user_device ADD unique index UKnfrn6f2pu3tqcwhqen0d6cq7u (owner,push_notification_id);
Upvotes: 0
Reputation: 7937
ALTER TABLE user_device ADD CONSTRAINT UKnfrn6f2pu3tqcwhqen0d6cq7u UNIQUE KEY (owner,push_notification_id);
Try above code.
You didn't mention which type of key you want to make on that combination of column.
So i had mention that using UNIQUE KEY
keyword.
Hope this will helps you.
Upvotes: 2