1

From my previous question this was the solution I am accepting:

INSERT IGNORE INTO table_name
SET name = 'phill',
    value = 'person',
    id = 12345;

But I also wanted to know if I could be multiple values like this

INSERT IGNORE INTO table_name
SET (name = 'phill', value = 'person', id = 12345),
    (name = 'bob', value = 'person', id = 12346);

1 Answer 1

4
INSERT IGNORE INTO table_name(name,value,id) VALUES 
('phill','person',12345),('bob','person',12346)
Sign up to request clarification or add additional context in comments.

2 Comments

if id 12345 already exists, does the entire insert fail or only that single row? In other words, if phill exists, will bob still be inserted?
@alex9311: Only rows that cause error are discarded, not the whole statement .

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.