Write a Delete mysql query in Magento 2 standard way without Model file.

Write a SQL delete() query using Magento standard way for delete specific row using Magento 2.

You can write direct SQL query delete() without worrying about Model operation using given code snippet in the blog.

Return Type: delete() return type is int. The number of affected rows for delete operation in a table.


Remove all the rows with Status equals Pending in sales_order table.

Output: No. of affected deleted rows.

Check for other Direct Sql Query in Magento 2