We can build an insert statement easily, too.
my ($sql, @sql_params) = INSERT INTO 'foo',
INTO takes a table, which it feeds to
INSERT function likewise takes a list of table columns (in an array ref), followed by
VALUES, which itself takes an arrayref of the data you’re going to put into the columns. All the scalars in that arrayref are passed back in
@sql_params and filled in as placeholders.
Inserting with a subselect is supported, which we will cover later.