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.

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

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.