0

I have a table called products and one of columns is called names.

When I insert a new product, I want to check if name of the new product already exists in names and then show an error message.

Anyone have any ideas?

1
  • What is the data type of names? Commented Mar 18, 2020 at 16:18

1 Answer 1

1

You should add a unique constraint on your names column:

ALTER TABLE products ADD UNIQUE (names);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.