Skip to content
Advertisement

Insert into multiple tables in one query

Assuming that I have two tables, names and phones, and I want to insert data from some input to the tables, in one query. How can it be done?

Advertisement

Answer

MySQL doesn’t support multi-table insertion in a single INSERT statement. Oracle is the only one I’m aware of that does, oddly…

INSERT INTO NAMES VALUES(...)
INSERT INTO PHONES VALUES(...)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement