7.2. Custom SQL

fmCustomSQL, fmAddNewSQLDialog, fmEditExistSQLDialog, fmDialogCustomSqlEditor, fmCustomSqlFillParamDialog, fmMySQLHelp - Custom SQL Section

Sub-pages listing:

If you are using the Standard Edition of Store Manager for Magento, the Custom SQL section will be disabled.

To use the features in this section, you will need to upgrade to our PRO Edition. Please click the following link, for additional information: Store Manager for Magento Plans & Pricing

The "Custom SQL" section facilitates direct modification, and management of your store database, via user created and specified, SQL commands. Typical usages are increasing item quantities for products of a specific manufacturer, or to remove discounts, that were previously applied to particular items, within the store database.

To take advantage of this feature, select the Tools tab -> Custom SQL section, which subsequently allows for direct manipulation, using SQL language queries and commands.

Custom SQL

When you open the "Custom SQL" page, it should be apparent that it resembles the "Create New Report" page(s).

custom SQL tabs

The page contains three tabs - Edit, Results and Logs - and is divided into two sections: the top section displays the contents (SQL text) of the query, and the bottom section displays a list of all available queries.

You may also open, and execute, a previously saved SQL Query file, by clicking the button shown on the illustration below.

Open SQL guery from a file

When creating a new query (by clicking the [New] SQL buttom), you will need to specify its name, and click [OK], to begin.

New Custom SQL

At the bottom part of the page you'll see the query with this name created. Now you can either run a Query builder or write query text in the top part of Edit tab directly.

Run query builder

When you're finished with this query hit the [Save] button. Then you can execute it by pressing the [Execute SQL] button.

Execute SQL

The results tab will appear, showing the returned data, arranged according to a certain condition.

If the query wasn't executed, you can check the "Logs" tab for errors.

Logs tabs

Logs tab will be cleared after you close Store Manager.

When constructing complicated queries, it's more convenient to use Visual Query Builder.

Visual query builder form

This section can be used to work with your store DB, fetching data easier and faster.