phpMyAdmin Run MySQL Query Tutorial

Learn how to execute MySQL queries with the phpMyAdmin tool

This tutorial explains how to execute MySQL queries by using the phpMyAdmin tool. There are two ways to do that with the phpMyAdmin interface.

Execute MySQL queries with the SQL tab

You can execute a MySQL query towards a given database by opening the database with phpMyAdmin and then clicking on the SQL tab. A new page will load, where you can provide the desired query. When ready click the Go button to perform the execution.

The page will refresh and you will see the results from the query you provided.

Construct and execute MySQL queries with the Query tab

The other way to query a MySQL database with the phpMyAdmin tool is to use the Query tab. There you can define different search conditions, sort the results and query multiple tables.

The columns which will be included in the MySQL statement should be picked from the Column drop-down menus. Also the Show checkbox should be selected for each column.

Through the Sort drop-down menu you can visualize the result sorted in an ascending or a descending order. With the Sort order drop-down you can choose which column should appear where in the results.

In the Criteria text field you should enter the criteria according to which the search will be completed.

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.

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.

Then you should select the tables used in the query from the Use Tables list.

To run the query click on the Submit Query button.

You can find more details about the MySQL syntax in the official MySQL Documentation.