Split SQL insert statements for a schema using other datasets

Hello, I’ve been trying to generate SQL statements for a schema that has fields from another schema(field type: Dataset Column). The output is in the form of a single insert statement.

My schema: https://www.mockaroo.com/39dd86a0

The first 3 columns(id, first_name, last_name) belong to the Person Dataset
The last 2 columns(ip_address, IMEI_hardware_id) belong to the Device Dataset

Output I got: insert into MOCK_DATA (id, first_name, last_name, ip_address, IMEI_hardware_id) values (1, ‘Conrad’, ‘Domesday’, ‘196.17.41.148’, 400997199931300);

Output I want: [“insert into Person(id, first_name, last_name) values (1, ‘Conard’, ‘Domesday’)”, “insert into Device(ip_address, IMEI_hardware_id) values (‘196.17.41.148’, 400997199931300)”] - not exactly, but something like this

or any other workaround that splits the insert statements

Thanks in advance

P.S. Mockaroo is an excellent tool

You can use the “formula” data type and using the function:
from_dataset(DatasetName, Field, Criteria).
The criteria obviusly is the rule to pick the specific tuple you want, for exemple you can do something like this:
ID: from_dataset(“Persona”, “id_persona”, first_name = “John”)
In this way you can pick the id_persona from Persona dataset where name is John.
Hope you can solve with this!