user1925819
user1925819

Reputation: 19

insert one-many relationship using SQL

Please let me know how to insert one-many relationship in a single query. I have table A (aId,name,surname) table B (bId, street, pincode,aId)

Upvotes: 0

Views: 182

Answers (1)

Bacon Bits
Bacon Bits

Reputation: 32170

You don't. This is why transactions exist. You start a transaction, submit all your queries, and then commit the transaction. The database goes from one state where none of the queries are completed to a state where all of the queries are completed. There is no in between state to worry about. Transactions are how RDBMSs implement the Atomicity component of ACID.

Upvotes: 2

Related Questions