Database insert into table and sub table

Hopefully, this will help: