Fetchall() mysql query in Magento 2.

Mysql fetchAll() query using Magento standard way for fetch all the records of the custom query.

You can fetch all the selected record from the table using direct SQL query fetchAll() without worry about the Model operation.

Return Type: fetchAll() always return as array based on your query conditions.

Base Definition of function:

Let’s we are fetching all the record’s from sales_order table, with all the records with status equals to pending.

Using Fetchall Output is arrays of records from a table.