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. 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 user who is using the DROP command, must have DROP privilege for each table(s) he wants to drop. The [TEMPORARY] option ensures you remove temporary tables only. 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. Drop table if exists: We can write a statement as below in SQL Server 2016 to remove a stored table if it exists. Let’s walk-through with few examples of important database objects to see how we can use DROP IF EXISTS option effectively. The command removes all the data and table definition from the database. Creating & Dropping Table using DROP TABLE IF EXISTS . Also, the EXIST clause can be an option of the CREATE or DROP query. The output will be like this. DROP TABLE IF EXISTS dbo.temp. In mysql 8 it works , but you have some errors in your code. In MySQL, DROP TABLE command removes one or more tables from an existing database. How to drop a table IF EXISTS in MySQL. 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. 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 ( … Query Catalog Views. 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. MySQL DROP TABLE foreign keys - The better way All I had to do was add a space between DELIMITER and // on the first line, and everything worked fine. 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. I realize I could use the following query to check if a table exists or not It's an old question but it came up as I was looking for DROP TABLE IF EXISTS. In the following example, the first statement will check if a table named Test exists in the tempdb database. DROP TABLE . You can query catalogs views (ALL_TABLES or USER_TABLE i.e) to check if the required table exists: If it does exists then it will try to DROP the table. 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. Your non-working code did not work on my MySQL 5.1.70 server. 1. Specifically, whenever I want to drop a table in MySQL, I do something like. Does Oracle have a similar mechanism? To remove a table in MySQL, use the DROP TABLE statement. 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.