Hacking with PHP has been updated for PHP 7 - click here! >>

Deleting tables

If you ever want to permanently delete tables from your database one at a time, the command to use is "DROP table ;", so "DROP usertable;" will delete the usertable table we just created, "DROP AnotherTable;" will delete the AnotherTable table, etc.

If you want to delete all tables in a database at once, it is easiest to use the "DROP DATABASE some_database " functionality already discussed - when a database is deleted, all tables it holds are also deleted.


If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Inserting data >>

Previous chapter: Making table changes

Jump to:


Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.