Home >Database >Mysql Tutorial >Detailed explanation of how to write SQL statements to delete tables in different databases

Detailed explanation of how to write SQL statements to delete tables in different databases

Y2J
Y2JOriginal
2017-05-22 14:57:001827browse

This article mainly introduces the relevant information about how DROP TABLE is written in different databases. Friends who need it can refer to

How DROP TABLE is written in different databases.

1, in 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]

【Related recommendations】

1. Mysql free video tutorial

2. mysql 5.7 Changing the database data storage location Detailed explanation of examples

3. Detailed explanation of the method of importing mysql big data into Navicat and reporting errors

4. Detailed explanation of examples of unlocking and locking tables in MYSQL

5. How to improve the database query speed of millions of items

The above is the detailed content of Detailed explanation of how to write SQL statements to delete tables in different databases. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn