mysqlsqlsql-insertmultiple-tables

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?


Solution

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