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

May 22, 2017 pm 02:57 PM
drop table

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]
Copy after login

2, in Oracle:

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

3, in Sql Server

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

【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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement drag-and-drop sorting and drag-and-drop operations in uniapp How to implement drag-and-drop sorting and drag-and-drop operations in uniapp Oct 19, 2023 am 09:39 AM

Uniapp is a cross-platform development framework. Its powerful cross-end capabilities allow developers to develop various applications quickly and easily. It is also very simple to implement drag-and-drop sorting and drag-and-drop operations in Uniapp, and it can support drag-and-drop operations of a variety of components and elements. This article will introduce how to use Uniapp to implement drag-and-drop sorting and drag-and-drop operations, and provide specific code examples. The drag-and-drop sorting function is very common in many applications. For example, it can be used to implement drag-and-drop sorting of lists, drag-and-drop sorting of icons, etc. Below we list

Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Jun 19, 2024 am 09:55 AM

Shortly after Tesla launched the Model 3 Highland refresh towards the end of last year, the US federal EV tax incentive rules changed, cutting the potential discount in half for eligible buyers because of Tesla's use of Chinese LFP cells in the new M

Can't drop database 'database_name'; database doesn't exist - How to solve MySQL error: Can't drop database, database doesn't exist Can't drop database 'database_name'; database doesn't exist - How to solve MySQL error: Can't drop database, database doesn't exist Oct 05, 2023 am 11:46 AM

How to solve MySQL error: Unable to delete database, database does not exist Overview: MySQL is a commonly used relational database management system. When using MySQL, we often need to manage the database, including creating databases, deleting databases and other operations. However, when deleting a database, sometimes you will encounter the error message "Can'tdropdatabase'database_name';databasedoesn'texist", that is, you cannot delete it.

How to use vue3 table component How to use vue3 table component May 12, 2023 pm 09:40 PM

Basic table Before developing the table component, first think about what style of API to use. Because the author uses element in production work, the styles of the previous components are similar to element, but this time I do not plan to use the element style. , I plan to change it and display it directly: We expect users to use it like this: constdataList=[{id:1,name:'"JavaEE Enterprise Application Practice"',author:'dev1ce',price:'10.22',desc:&# 3

What are the differences between drop and delete? What are the differences between drop and delete? Dec 29, 2023 am 10:09 AM

The difference between drop and delete: 1. Function and purpose; 2. Operation object; 3. Reversibility; 4. Space release; 5. Execution speed and efficiency; 6. Interaction with other commands; 7. Persistence of influence; 8 , syntax and execution; 9. Triggers and constraints; 10. Transaction processing. Detailed introduction: 1. Function and purpose. "DELETE" is a data operation language command, mainly used to delete some or all tuples from a table, that is, delete data content. "DROP" is a data definition language command, used to delete data from a table. Delete one from the database and so on.

What is the difference between drop and delete What is the difference between drop and delete Dec 29, 2023 am 11:46 AM

The difference between drop and delete: 1. Object; 2. Impact on the database after operation; 3. Syntax; 4. Behavior of occupying resources; 5. Ability to recover data after deletion; 6. Other differences. Detailed introduction: 1. Object, "DELETE" is used to delete records in the table, "DROP" is used to delete the entire table; 2. The impact on the database after the operation, "DELETE" will not change the structure and table definition of the database after execution If there is any impact, after "DROP" is executed, the structure and definition of the entire table will be deleted, etc.

How to add a row to table in jquery How to add a row to table in jquery May 29, 2023 pm 01:24 PM

How to add a row to a table with jquery: 1. Create an html sample file and reference the jQuery file; 2. Use "table", "tr", "td" tags to create a table; 3. Create a button button and bind the onclick click event , and then execute the "addhang()" function; 4. Define a variable tr within the function to save the table rows that need to be added. The $ symbol obtains the table object, and the "append()" method is used to add a row to the table.

What is the difference between drop and delete What is the difference between drop and delete Dec 29, 2023 pm 01:59 PM

The difference between drop and delete: 1. Function and purpose; 2. Operation object; 3. Reversibility; 4. Space release; 5. Execution speed and efficiency; 6. Logging; 7. Interaction with other database commands; 8. Impact Persistence; 9. Syntax and execution; 10. Triggers and constraints; 11. Transaction processing. Detailed introduction: 1. Function and purpose. DROP is mainly used to delete data structure, including internal data content. DELETE is mainly used to delete data content. It does not delete data structure and only affects the data in the table, etc.

See all articles