24/7 U.S. Support – 877-595-4482
One of the features of PrestaShop is the ability to use the SQL manager function to make custom queries to find specific data within the database of the shop. You can create queries, view the results, and export them to a CSV file. The following tutorial reviews how to add SQL queries in PrestaShop 1.5.
Note the blue field and the instructions. This is an information field provided by Prestashop. It gives direct instructions on how to add a new query, view the results and export the results. We will focus on simply adding query in this article.
The two required fields are the name of the query you want to create as well the query itself. Click on the NAME field and name the query. For example, the sample screenshots below will show a simple MySQL Query (for information on using MySQL queries, go to MYSQL documentation on Entering Queries) called "newquery" and then it will show a very simple MySQL query pulling data from the PS_ADDRESS table:
In order to add the query, simply click in the REQUEST field and type in the code. The request above is a simple select request which will show all the addresses in the PS_ADDRESS table.
The table attributes are listed and are added to the query by simply clicking on the ADD TRIBUTE button beside each table attribute. The attribute is added into the query field for you saving some typing time (especially if the attribute name is pretty long). You can click on multiple tables for the query. Care should be taken with the queries you are running on the database. Remember that you are taking resources from the server to run these queries.
Here you will see the following options:
|Icon||Action description of icon|
CSV export option
View query results
Edit query results
This screen also lets you back up and EDIT the query. Editing the query is exactly the same as adding the request expect that code for the query already exists.
The EDIT option is available in the ACTION icons list as well as the DELETE option represented by the trashcan icon. If you wish to delete a specific query, you can delete by selecting the checkbox and the clicking on DELETE SELECTED, or you can click on the trashcan icon for the specific query you wish to remove.
Querying the database is made into an simple task with the PrestaShop SQL Manager feature. However, it requires some knowledge of querying SQL databases in order to properly obtain the proper data and show the resutls in a meaningful manner. Make sure to show care when crafting queries as SQL queries can be very large obtaining unnecessary data and possibly resulting in a resource hit on your server.
|1.||Backing up your Database in PrestaShop 1.5|
|2.||How to Restore a Backup in Prestashop 1.5|
|3.||Exporting SQL data from PrestaShop 1.5|
|4.||Adding SQL Queries in PrestaShop 1.5|
|5.||Setting the Encoding Type in SQL Manager for PrestaShop 1.5|
|6.||Importing through CSV in Advanced Parameters of PrestaShop 1.5|
|Email:||support@WebHostingHub.com||Ticket:||Submit a Support Ticket|
|Chat:||Click To Chat Now|