Write a fetchCol() Sql query in Magento 2.

Write a Mysql fetchCol() query using Magento standard way without using Model file, to Fetches the first column of all SQL result rows as an array.

Return Type: fetchCol() always return as an array.

Base Definition:

Let’s write a query from the sales_order table to accomplish fetchCol() query operation.

An Array result with value is entity_id of sales_order table.

15, 17 and 19 is the entity_id with pending status.