Categories:

Table, View, & Sequence DDL

UNDROP TABLE

Restores the most recent version of a dropped table.

See also:

DROP TABLE , SHOW TABLES

Syntax

UNDROP TABLE <name>

Parameters

name

Specifies the identifier for the table to restore. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

Usage Notes

  • Restoring tables is only supported in the current schema or current database, even if the table name is fully-qualified.

  • If a table with the same name already exists, an error is returned.

Examples

Restore the most recent version of a dropped table (this example builds on the examples provided for DROP TABLE):

UNDROP TABLE t2;

+---------------------------------+
| status                          |
|---------------------------------|
| Table T2 successfully restored. |
+---------------------------------+