How to handle "duplicate entry 'value' for key 'column'" in sql?

Example:

INSERT INTO users (id, name) VALUES (1, "John");
This message appears when you try to insert a value that already exists in a column with a unique constraint.

Solution:

-- Insert a unique value or update the existing record
INSERT INTO users (id, name) VALUES (2, "John");

Beginner's Guide to SQL