Insert an Account with Contacts
A child record needs its parent's Id, so the parent Account is inserted before its Contacts.
Your task
Insert one tagged Account and three Contacts that belong to it, using exactly two DML statements.
String tag = 'AS-INSERTC-' + UserInfo.getUserId() + '-' +
String.valueOf(Datetime.now().getTime());
String tagPattern = tag + '-%';
List<String> lastNames = new List<String>{ 'Ito', 'Park', 'Diaz' };
Integer dmlBefore = Limits.getDmlStatements();
Account parent = new Account(Name = tag);
List<Contact> contacts = new List<Contact>();Requirements
insert parent;should be present before any Contact is builtAccountId = parent.Idshould be present on each Contact(SELECT Id FROM Contacts)should be present in the Account queryContacts linked: 3should be printedOrphan contacts: 0should be printedDML used: 2should be printed