How to run SQL Queries on a database using phpmyadmin


This tutorial is to teach you how to run MySQL 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 broken into 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 MySQL 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 MySQL query on. This opens the table details in the right hand of the phpMyAdmin setup 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 MySQL commands.

Go to the right hand side and click on the database name. This will bring up the details for the database in the right hand window of the phpMyAdmin setup. Click the MySQL button at the top of the window. This opens a box, titled “Run MySQL query/queries on database. You will then need to type the MySQL 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, you click on Go. A pop-up will ask if really want to perform the action. Click OK. The command screen will then confirm that your MySQL query has been successful. You have just deleted a field from a table.

For more information about MySQL syntax, visit the MySQL documentation available here. Just click on the icon under the phpMyAdmin name, that has the red MySQL on it. This is the end of this tutorial. You now know how to run a MySQL query on a database using phpMyAdmin setup.

Advertisements

2 thoughts on “How to run SQL Queries on a database using phpmyadmin

  1. Pingback: get dofollow web 2.0 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s