Running SQL queries on a database with phpMyAdmin

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 right 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. This opens 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, 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 SQL query has been successful. You have just deleted a field from a table.

For more information about SQL syntax, visit the MySQL documentation available here. Just click on the icon under the phpMyAdmin name, that has the red SQL on it.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Managing MySQL Databases With PHPMyAdmin

On the main cPanel page, scroll down to the section called Databases, and click on the icon named...

How To Create A MySQL Database

On the main cPanel page, scroll down to the Database section, and click on the MySQL Databases...

Importing databases and tables with phpMyAdmin

The phpMyAdmin main screen is broken into two sections. The left hand side is blue, and this is...

Inserting fields into database tables with phpMyAdmin

Let's begin by locating the database name in the blue section on the left of the phpMyAdmin...

Deleting tables in a database with phpMyAdmin

For this tutorial, we will be using a database with two tables for the example. In the left hand...

Powered by WHMCompleteSolution