insert data in multiple tables in one mysql query
Here are two ways to provide the appearance of &quot;should be performed in single query&quot;.  What is your goal behind requesting such?
Data integrity  (see &quot;ACID&quot;)
There are cases where you 'must' tie two inserts together, else the integrity of the database is in question.  The classic example is moving money from one account to another, but that usually involves a single table.
 BEGIN;
 UPDATE ... take money out of one person's account
 UPDATE ... add that money to another person's account
 COMMIT;

Whether the same table or different tables are involved, the above guarantees that both operations will be done or neither will be done.  The &quot;money&quot; won't vanish even if there is a power failure at any time during the &quot;transaction&quot;.
Is that what you need for &quot;inserting into two table at the same time&quot;?  A transaction can, and should, be used for any set of writes to table(s) in database(s) (on a single instance of MySQL) where the writes must be done &quot;at the same time&quot;.
Programming
Akina suggests using a Stored Procedure as a way to programmatically wrap the sequence of events, thereby giving the user the appearance of a &quot;single operation&quot;:
CALL Transfer(acct1, acct2, amount);