Is there a way to insert two tuples into two different tables, where tuple1 and foreign key on tuple2, in a single query, in sql?
PARENT TABLE:
- id
- first name
CHILD TABLE:
- id
- first name
- father_id
tuple1 (parent tuple)
{id: 1, name: ‘father’}
tuple2 (child tuple)
{id: 1, name: ‘fiflio’, parent_id: ‘1’}(parent_id = 1 = id of tuple1 )
insert these two tuples (tuple1, tuple2) into two different tables (PARENT TABLE, CHILD TABLE), single query
Is there a way to insert two tuples into two different tables, where tuple1 and foreign key on tuple2, in a single query, in sql?
Alyosha Vallucci is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.