All Products
Search
Document Center

MaxCompute:DROP TABLE

Last Updated:Apr 09, 2026

The DROP TABLE statement drops a non-partitioned table or a partitioned table.

Usage notes

  • Use caution when dropping a table. You can restore a dropped table only if the backup and restore feature is enabled for the project and the table is within the configured data retention period. For more information, see local backup.

  • Dropping a table reduces the storage usage of the MaxCompute project.

Syntax

DROP TABLE [IF EXISTS] <table_name>; 

Parameters

Parameter

Required

Description

IF EXISTS

No

Without IF EXISTS, attempting to drop a non-existent table returns an exception. With IF EXISTS, the statement succeeds even if the table does not exist.

table_name

Yes

The name of the table to drop.

Examples

-- Drop the sale_detail table. The statement succeeds regardless of whether the table exists.
DROP TABLE IF EXISTS sale_detail; 

Related commands

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

  • ALTER TABLE: Alters a table.

  • TRUNCATE: Removes all rows from a specified table.

  • DESC TABLE/VIEW: Describes an internal table, view, materialized view, external table, clustered table, or transactional table.

  • SHOW: Shows the DDL statement for a table, lists all tables and views in a project, or lists all partitions in a partitioned table.