In mysql 8 it works , but you have some errors in your code. How to drop a table IF EXISTS in MySQL. Specifically, whenever I want to drop a table in MySQL, I do something like. The user who is using the DROP command, must have DROP privilege for each table(s) he wants to drop. The way I used to do this was drop these tables in this exact order: drop table if exists order_details; drop table if exists orders; drop table if exists customers; That was the only order in which the MySQL tables could be dropped. Let’s walk-through with few examples of important database objects to see how we can use DROP IF EXISTS option effectively. In MySQL, DROP TABLE command removes one or more tables from an existing database. All I had to do was add a space between DELIMITER and // on the first line, and everything worked fine. Also, the EXIST clause can be an option of the CREATE or DROP query. Your non-working code did not work on my MySQL 5.1.70 server. It's an old question but it came up as I was looking for DROP TABLE IF EXISTS. The output will be like this. if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'Scores' AND TABLE_SCHEMA = 'dbo') drop table dbo.Scores; Most modern RDBMS servers provide, at least, basic INFORMATION_SCHEMA support, including: MySQL , Postgres , Oracle , IBM DB2 , and Microsoft SQL Server 7.0 (and greater) . The syntax to DROP a table is as follows: DROP [TEMPORARY] TABLE [IF EXISTS] some_table [, some_table] ... [RESTRICT | CASCADE] As we can see, the IF EXISTS clause is optional. Query Catalog Views. DROP TABLE IF EXISTS dbo.temp. In the following example, the first statement will check if a table named Test exists in the tempdb database. DROP TABLE IF EXISTS `table_name`; This way, if the table doesn't exist, the DROP doesn't produce an error, and the script can continue. You can query catalogs views (ALL_TABLES or USER_TABLE i.e) to check if the required table exists: The [TEMPORARY] option ensures you remove temporary tables only. The command removes all the data and table definition from the database. Drop table if exists: We can write a statement as below in SQL Server 2016 to remove a stored table if it exists. The basic syntax of the command is as follows: DROP [TEMPORARY] TABLE [IF EXISTS] table_name [, table_name] [RESTRICT | CASCADE]; Let’s break down the syntax: The DROP TABLE statement deletes a table and its rows permanently. Creating & Dropping Table using DROP TABLE IF EXISTS . 1. If it does exists then it will try to DROP the table. I realize I could use the following query to check if a table exists or not DROP TABLE IF EXISTS DOCENT; DROP TABLE IF EXISTS MEMBER_SPECIALTY; DROP TABLE IF EXISTS INVITE; DROP TABLE IF EXISTS GALA_NIGHT; DROP TABLE IF EXISTS CUSTOMER; DROP TABLE IF EXISTS PAINTING; DROP TABLE IF EXISTS MUSEUM; DROP TABLE IF EXISTS PAINTER; CREATE TABLE PAINTER ( … Drop table by using the new method Drop procedure if exists: Now we will drop the stored procedure we created at the start of the article by executing the following code. In its simplest form, the syntax for the DROP TABLE statement in MySQL is: DROP TABLE table_name; However, the full syntax for the MySQL DROP TABLE statement is: DROP [ TEMPORARY ] TABLE [ IF EXISTS ] table_name1, table_name2, ... [ RESTRICT | CASCADE ]; Parameters or Arguments TEMPORARY Optional. MySQL DROP TABLE foreign keys - The better way DROP TABLE . Does Oracle have a similar mechanism? Oracle does not provide IF EXISTS clause in the DROP TABLE statement, but you can use a PL/SQL block to implement this functionality and prevent from errors then the table does not exist. To remove a table in MySQL, use the DROP TABLE statement.