In the following part of our PhpMyAdmin tutorial we will show how to construct and run a MySQL query.
Actually there are two options to run a MySQL query. It depends on your MySQL syntax level of knowledge.
The one for advanced users is through the SQL tab. There you should enter the entire SQL query code and click on the Go button to execute it.
The other option is to construct a MySQL query in the Query tab.
There you can define different search conditions, sort the results and query multiple tables.
You should select the tables used in the query from the Use Tables list.
The fields which will be included in the SELECT MySQL statement should be picked from the Field drop-down menus. The Show check box should be selected.
In the Criteria text field you should enter the criteria according to which the search will be completed.
Through the Sort drop-down menu you can visualize the result sorted in an ascending or a descending order.
The text window located below allows you do add extra search conditions.
Additionally, you can use the Ins and the Del check boxes to add or delete text rows for search conditions. The same can be performed through the Add/Delete Criteria Row drop-down menu. To add or delete columns use the corresponding Ins and Del check boxes or the Add/Delete Field Columns drop-down menu.
In the Modify section you can define the relations between the fields (whether they are connected through the AND or the OR logical operators).
You need to click on the Update Query button to complete the modifications.
To run the query click on the Submit Query button.
The query which we have included in our example is:
SELECT `AT_admins` . * FROM AT_admins WHERE (`AT_admins`.`login` LIKE “a%”);
It shows all the records from the AT_admins table for which the login field starts with “a”.
You can find more details about the MySQL syntax in the official MySQL Documentation.