How to write a SQL Safe Query using quoteInto() method magento 2?

Using a SQL quoteInto() method, Write a Query using Magento standard way with SQL Safe quoted value.

Return Type: quoteInto() always returns a string with SQL-safe quoted value placed into the original text.

quoteInto() method used in the direct SQL query for a safe quote with SQL conditions. Continue reading “How to write a SQL Safe Query using quoteInto() method magento 2?”

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. Continue reading “Write a fetchCol() Sql query in Magento 2.”

Write a Delete sql 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. Continue reading “Write a Delete sql query in Magento 2 standard way without Model file.”