mysql drop table if exists code example

Example 1: sql drop table if exists

DROP TABLE IF EXISTS dbo.Customers

Example 2: mysql drop database if exists

DROP DATABASE IF EXISTS database_name;

Example 3: drop table if exists

DROP TABLE IF EXISTS dbo.Scores

Example 4: drop table if it exists mysql

DROP TABLE IF EXISTS <TABLE NAME>;

Example 5: mysql create table if not exists

CREATE TABLE [IF NOT EXISTS] table_name(
   column_1_definition,
   column_2_definition,
   ...,
   table_constraints
) ENGINE=storage_engine;

Example 6: mysql drop table cascade

SET FOREIGN_KEY_CHECKS = 0;
drop table if exists <your_1st_table>;
drop table if exists <your_2nd_table>;
SET FOREIGN_KEY_CHECKS = 1;

Tags:

Php Example