How to write DROP TABLE in different databases

How to write DROP TABLE in different databases

How to write DROP TABLE in different databases

1.MySql

DROP TABLE IF EXISTS [table_name]

2. In Oracle:

BEGIN
  EXECUTE IMMEDIATE 'DROP TABLE [table_name]';
  EXCEPTION WHEN OTHERS THEN NULL;
END;

3. In Sql Server

IF EXISTS (
  SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
  WHERE TABLE_NAME = '[table_name]')
DROP TABLE [table_name]

Thank you for reading, I hope it can help you, thank you for your support of this site!

<<:  Detailed steps to install Anaconda on Linux (Ubuntu 18.04)

>>:  How to implement responsive layout in vue-cli

Recommend

Implementing carousel with native JavaScript

This article shares the specific code for impleme...

Use HTML to write a simple email template

Today, I want to write about a "low-tech&quo...

The difference between z-index: 0 and z-index: auto in CSS

I've been learning about stacking contexts re...

How to run py files directly in linux

1. First create the file (cd to the directory whe...

MySQL decimal unsigned update negative numbers converted to 0

Today, when verifying the concurrency problem of ...

What is web design

<br />Original article: http://www.alistapar...

CSS3 realizes the website product display effect diagram

This article introduces the effect of website pro...

Implementation example of video player based on Vue

When the existing video player cannot meet the ne...

Example analysis of the usage of the new json field type in mysql5.7

This article uses an example to illustrate the us...

MySQL uses SQL statements to modify table names

In MySQL, you can use the SQL statement rename ta...

Vue implements book management case

This article example shares the specific code of ...

An article to understand operators in ECMAScript

Table of contents Unary Operators Boolean Operato...

JavaScript to achieve lottery effect

This article shares the specific code of JavaScri...