0

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

2 Answers 2

2
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.

Sign up to request clarification or add additional context in comments.

Comments

0

Do Like this.

ALTER TABLE user_device ADD unique index UKnfrn6f2pu3tqcwhqen0d6cq7u (owner,push_notification_id);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.