Question: The MySQL manual states:

> 
> If you specify ON DUPLICATE KEY UPDATE, and a row is inserted that
>  would cause a duplicate value in a UNIQUE index or PRIMARY KEY
> 
> 
> 

What if you have a table that does not have a UNIQUE index or PRIMARY KEY, but you don't want to duplicate an entry for a column (say user\_id).

Is there a way to do it in MySQL?

Answer: 
```
INSERT INTO `table` (value1, value2) 
SELECT 'stuff for value1', 'stuff for value2' FROM `table` 
WHERE NOT EXISTS (SELECT * FROM `table` 
                  WHERE value1='stuff for value1' AND value2='stuff for value2') 
LIMIT 1

```

Source: [How to 'insert if not exists' in MySQL?](https://stackoverflow.com/questions/1361340/how-to-insert-if-not-exists-in-mysql)
If you want the database to control data integrity, then a UNIQUE index is simply MYSQL's way of creating a UNIQUE constraint on that data. 

If you don't want the database to be in charge of data integrity, then you will need to control the data some other way, through your application or ETL code. Typically this will involve scanning the table beforehand in order to validate that the value does not already exist, and then performing an insert.

With a clearer question as to what you are trying to do, we can help give better answers.