Top community members
All Questions Ask Question

Welcome to Dirask IT community! ❤ 💻
We are community of people that helps each other.

If you think you have some skills to help others

help someone and become a part of our community - List Q & A

MySQL - drop table if exists

1 answers
4 points

I have a question how do I drop table if exists in MySQL?
I know it is possible in other databases.
Also I know I can remove this table with sql:

DROP TABLE `users_table`;

But it doesn't protect me from error if this table was already removed
or it never existed.

1 answers
2 points

Quickest way to do which will solve your problem:

DROP TABLE IF EXISTS `users_table`;


users_table - database table name you want to remove

if exists - will ensure you won't get any error if the table was never created

From MySQL documentation:

DROP TABLE IF EXISTS `table_name`;


0 comments Add comment

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more