• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. Database Quick Start
  5. Creating and Managing Tables
  6. Deleting Data from a Table

Deleting Data from a Table

You can delete outdated data from a table by row.

SQL statements can only access and delete an independent row by declaring conditions that match the row. If a table has a primary key column, you can use it to specify a row. You can delete several rows that match the specified condition or delete all the rows from a table.

For example, to delete all the rows whose c_customer_sk column is 3869 from table customer_t1, run the following statement:

DELETE FROM customer_t1 WHERE c_customer_sk = 3869;

To delete all rows from the table, run either of the following statements:

DELETE FROM customer_t1;
TRUNCATE TABLE customer_t1;
NOTE:

If you need to delete an entire table, you are advised to use the TRUNCATE statement rather than DELETE.

To delete a table, execute the following statement:

DROP TABLE customer_t1;