1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

MySQL Tutorial: Managing MySQL data


4 of 4

SQL Delete Statement - Removing Data
Often you need to remove old information from your database. You should be very careful when doing this because once it is gone, it's gone. That being said, when you are in phpMyAdmin, you can remove information a number of ways. First select the database on the left. One way to remove entries is by then choosing the browse tab on the right. Next to each entry you will see a red X. Clicking the X will remove the entry, or to delete multiple entries you can check the boxes on the far left and then hit the red X at the bottom of the page.

Another thing you can do is click the search tab. Here you can perform a search. Let's say the doctor in our example database gets a new partner who is a pediatrician. He will no longer be seeing children, so anyone under 12 needs to be removed from the database. You can preform a search for an age less than 12 from this search screen. All the results are now displayed in the browse format where you can delete individual records with the red X, or check multiple records and click the red X at the bottom of the screen.

Removing data by searching from a query window or command line is very easy, but please be careful:

DELETE FROM people WHERE age < 12 

If the table is no longer needed you can remove the entire table by clicking on the "Drop" tab in phpMyAdmin or running this line:

 DROP TABLE people 

  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Learn MySQL
  5. MySQL Delete Statement

©2014 About.com. All rights reserved.