PHP & MySQL® Web Development All-in-One Desk Reference for Dummies®
by Janet Valade, Tricia Ballad, Bill Ballad
4.5. Removing Information from a Database
Keep the information in your database up to date by deleting obsolete information. However, be very careful when removing information. After you drop the data, it's gone forever. It cannot be restored. You only get it back if you enter it all again.
4.5.1. Removing information with an SQL query
You can remove a row or a column from a table, or you can remove the entire table or database and start over.
You can remove a row from a table with the DELETE query:
DELETE FROM tablename WHERE clause
|
You can delete a column from a table by using the ALTER query:
ALTER TABLE tablename DROP columnname
You can remove the entire table or database with
DROP TABLE tablename
or
DROP DATABASE databasename
4.5.2. Removing information with phpMyAdmin
The Database page in phpMyAdmin lists all the tables in a database. You can display the Database page by clicking the database name in the left panel or by selecting the database name from the Database drop-down list. From this page, you can delete the entire database or any table as follows:
Database: Drop the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access