DROP TABLE

Overview

Deletes a table and the data it contains from the database.

USAGE

Common Syntax:

DROP [TEMPORARY] TABLE [IF EXISTS] <tbl_name> [, <tbl_name>] ...

DETAILS

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

DROP TABLE

To delete a table in the currently selected database:

DROP TABLE tbl1;

The built-in function DATABASE() returns the currently selected database.

To explicitly specify a database from which to delete a table, use the DATABASE_NAME.TABLE_NAME notation:

DROP TABLE db1.tbl1;

IF EXISTS

By default, if you try to delete a table that does not exist, an error is raised.

To prevent an error when the specified table is not present, add the IF EXISTS clause:

DROP TABLE IF EXISTS tbl1;

If the specified table exists, it will be deleted. If the specified table does not exist, the query does not raise an error.

DROP TEMPORARY TABLE

To delete a temporary table:

DROP TEMPORARY TABLE tbl1;

Delete Multiple Tables

To delete multiple tables at once, specify the names separated by commas:

DROP TABLE db1.tbl1, db2.tbl1, db3.tbl1;

If some of the tables in the argument list do not exist, MariaDB Xpand will drop the tables that do exist and return an error listing non-existing tables it was unable to drop.

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES