MySQL DROP statement using phpMyAdmin

The MySQL DROP statement is one of many powerful DDL commands. Be it ALTER TABLE some_table DROP some_column or DROP some_table, this type of command can drastically change your data landscape because in executing MySQL DROP, you are completely removing objects from the database! If you are using the phpMyAdmin web interface, you can execute the MySQL DROP statement with just a few mouse clicks. Continue reading to see how…

low-light photo of water drops
Drops of water.
Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!


Note: The DROP statement is prevalent in most SQL dialects and is not limited in use to only MySQL.

Suppose we have a common ‘users’ table with 4 columns: ‘user_id’, ‘first_name’, ‘last_name’, and ‘country’:

phpMyAdmin-table-description
users table description.

For whatever reason, we have decided we no longer need the ‘country’ column and want to remove it completely from the ‘users’ table. How can we do that using MySQL DROP statement?

Removing a column with MySQL DROP statement in phpMyAdmin

In phpMyAdmin, simply check the checkbox on the far left on the column row you want to remove (in our example the ‘country’ column). Once chosen, click the Drop word just beside the red warning-like icon to complete the action. The screenshot below provides a complete visual overview of the steps.

phpMyAdmin-drop-column
Dropping a table column in phpMyAdmin.

!!!WARNING. YOU ARE ABOUT TO COMPLETELY REMOVE A COLUMN!!!

Not only am I myself extremely cautious, but so is phpMyAdmin. In carrying out the above-shown action, phpMyAdmin displays this warning message:

phpMyAdmin-DROP-column
Confirmation popup for dropping the ‘country’ column from table ‘users’.

After clicking the OK button, the command is executed. The screenshot below shows, the ‘users’ table no longer has the ‘country’ column as part of its definition:

phpMyAdmin-table-description-after-DDL
Table ‘users’ description after dropping the ‘country’ column.

Removing a table with MySQL DROP statement in phpMyAdmin

Should you decide that you no longer need a table as part of your database, you can use the MySQL DROP statement and completely remove it. Suppose I want to remove the ‘users’ table. How can I do that using the MySQL DROP statement?

First, check the checkbox on the far left for the table row you wish to remove. Then, click the Drop action word next to the warning-like icon. Essentially, the exact steps taken to remove a column, we are now applying them on a database level to the actual table object.

The below screenshot shows a visual overview of the entire process:

phpMyAdmin-drop-table
phpMyAdmin steps to remove the ‘users’ table from the database.

I’ll save my personal warning message in this section because phpMyAdmin provides one just the same:

phpMyAdmin MySQL DROP statement
Confirmation popup for dropping the ‘users’ table in phpMyAdmin.

Clicking the OK button executes the MySQL DROP statement, removing the ‘users’ table from the database.


Recommended Reading and Informational Resources

Feel free to visit the below resources for more information on the MySQL DROP statement, along with other blog posts I have written on using the phpMyAdmin web-based interface:

Take good care when removing database objects like tables, columns, indexes, and the like using the MySQL DROP statement. Always be sure that you actually want them completely removed from the database schema because once they are gone, they are indeed gone!


Like what you have read? See anything incorrect? Please comment below and thanks for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.

To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the β€˜Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.


Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, is performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.