How to get prefix with tablename in Magento 2?

Many times Magento 2 tablename have prefix value for each table.
We can get table name prefix with below way in Magento 2.

Using below code snippet you can get table with prefix code always,

In above function your table will get prefix value with table name.
If your table has prefix as mage_ then your table value will get like, mage_sales_order

Leave a Reply

Your email address will not be published. Required fields are marked *