yossi yossi - 5 months ago 27
SQL Question

sql - 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?

Please, if it can be done, explain the syntax.

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(...)