1. Home
  2. Computing & Technology
  3. PHP / MySQL

MySQL Tutorial: Managing MySQL data

By Angela Bradley, About.com

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

Index: MySQL Tutorial: Managing MySQL data

  1. Insert Into SQL - Add Data
  2. SQL Update Command - Update Data
  3. SQL Select Statement - Searching Data
  4. SQL Delete Statement - Removing Data

4 of 4

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn MySQL
  5. MySQL Tutorial - SQL Delete - SQL Delete Statement

©2008 About.com, a part of The New York Times Company.

All rights reserved.