I have an excel sheet with around 2.000 rows that i want to insert into my database.
The problem is that the table i want to insert the 2.000 rows into has a field that references to a foreign key in another table. Unfortunately a lot of queries fail, since the given foreign key does NOT exist.
I know that I can ignore foreign key checks, but this is not what i want. I don't want to ignore foreign key checks, I just want bad queries not to be executed.
Example:
INSERT INTO test (id, value) VALUES (10, 20);
INSERT INTO test (id, value) VALUES (20, 20);
The first query fails, since TEST.id references to foobar.id and there is no foobar.id=10. However, the second query would work, since foobar.id=20 exists, but the second query won't be executed, because the first one already failed. Is there any way I don't get an error on the first quiery and my other queries will still be executed?
I could write a php script, but I'd prefer a MySQL solution here.