Use of insertMultiple mysql query in Magento 2.

Write a Mysql insertMultiple() query using Magento standard way to insert a multiple row/records at a single time.

You can write direct SQL query insertMultiple() without worrying about the Model operation for insert multiple records in a specific table using below code snippet.

Return Type: insertMultiple() always return an integer number for affected rows in a table.

Base Definition of function:

Let’s we are writing a query from sales_order_status table to accomplish insertMultiple() query operation.

sales_order_status contains two fields only, status and label.

Output:
2

You can see new records are added to the sales_order_status table.

Check for Other Direct SQL Query in Magento 2