Running SQL queries on a database with phpMyAdmin

This tutorial is to teach you how to run SQL queries on a database with phpMyAdmin. We will assume that you are currently logged into phpMyAdmin and for the purpose of this tutorial, we will use a database with two tables as our example.

The phpMyAdmin main screen is in two sections. The left hand side is blue and this is where you will find your database listed. Below the database you will see the names of the tables that are in the database. The right hand side is a large white window and this is where the activity takes place.

To run SQL queries on a database the first thing you need to do is click the on the name of the database table that you want to run a SQL query on. This opens the table details in the right hand window. As you learned in another tutorial, "Deleting fields from database tables with phpMyAdmin", you can delete a field from a table by checking the box in the field row and clicking on the delete icon (the big red X below the table). In this tutorial you are going to learn how to delete a field using pure SQL commands.

Go to the left hand side and click on the database name. This will bring up the details for the database in the right hand window. Click the SQL button at the top of the window to open a box titled "Run SQL query/queries on database. You will then need to type the SQL command to delete the field from the table into the box.

It would look something like this:
ALTER TABLE 'this is where the name of the table goes' DROP 'this is where the name of the field goes'
Then when you are done, click on go. A pop-up will ask if you really want to perform the action. Click OK. The command screen will then confirm that your SQL query has been successful in deleting a field from the database table.

For more information about SQL syntax you can visit the MySQL documentation by clicking on the SQL icon on the left hand panel under the phpMyAdmin name.

For additional assistance, contact us by submitting a support ticket.

Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Quick Navigation

Client Login:



Remember Me