-3

How to insert data in different tables using MySql database?

like i want to insert cid=1,cname=sahil,bid=12345,amount=12000 customer cid,cname

bankb bid,cid,amount

2 Answers2

0

MySQL Does not support multiple table data insert using single query, however Oracle does it.

for MySQL you have to use multiple insert query

like

INSERT INTO NAMES VALUES(...)
INSERT INTO PHONES VALUES(...)

Source : sql - insert into multiple tables in one query

Community
  • 1
  • 1
Rakesh Singh
  • 1,250
  • 9
  • 8
-1

Its not efficient with simple query and so use Stored procedures. Refer the below links.

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/77ce4b34-581b-47c8-aad6-96910ecd8ab5/correct-way-to-insert-data-into-multiple-tables-stored-procedure?forum=sqlgetstarted

Madhu
  • 2,416
  • 3
  • 15
  • 33