All Products
Search
Document Center

MaxCompute:DROP TABLE

Last Updated:Mar 26, 2026

Drops a non-partitioned table or a partitioned table.

Usage notes

  • Before dropping a table, confirm it can be safely removed. Proceed with caution. If a table is accidentally dropped, it can be restored if the backup and restoration feature is enabled for the project and the table is dropped within the backup data retention period specified for the project. For details, see Backup and restoration.

  • Dropping a table reduces stored data volume in the MaxCompute project.

Syntax

DROP TABLE [IF EXISTS] <table_name>;

Parameters

Parameter Required Description
IF EXISTS Optional If omitted and the table does not exist, an error is returned. If specified, a success message is returned regardless of whether the table exists.
table_name Required The name of the table to drop.

Examples

-- Drop the sale_detail table. A success message is returned regardless of whether the sale_detail table exists.
DROP TABLE IF EXISTS sale_detail;

Related statements

  • CREATE TABLE: Creates a non-partitioned table, a partitioned table, an external table, or a clustered table.

  • ALTER TABLE: Alters information about a table.

  • TRUNCATE: Clears the data in a specified table.

  • DESC TABLE/VIEW: Views information about internal tables, views, materialized views, external tables, clustered tables, and transactional tables.

  • SHOW: Views the SQL DDL statement that is used to create a table, views the information about all tables and views in a project, or views the information about all partitions in a table.