7.2.1. Custom SQL Linked to Products, or Linked to Categories
The "Custom SQL" section of Store Manager allows to link products or categories to a specific SQL that was previously created and run SQL commands directly on the main product page.
To perform this, during SQL query creation in Custom SQL section, choose "Linked to Products" or "Linked to Categories":
For example, create the query that would delete the gift card account with zero balance.
Go to the main product page. In the top panel, you can see the Custom SQL option.
Select the products and to activate the necessary SQL command, use the browse [...] button, which opens the drop-down list.
You can create as many commands as you need. Do not forget to link your SQLs to products or categories and you will be able to choose the necessary query on the product page.
To get more information about linking Custom SQL(s) to the Products or Categories look through this guide:
What Is Custom SQL? How to Use Magento Custom SQLs for Data Management?