Help Center > > Developer Guide> Database Quick Start> Creating and Managing Tables> Deleting Data from a Table

Deleting Data from a Table

Updated at:Mar 13, 2020 GMT+08:00

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:

1
DELETE FROM customer_t1 WHERE c_customer_sk = 3869;

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

1
DELETE FROM customer_t1;
1
TRUNCATE TABLE customer_t1;

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:

1
DROP TABLE customer_t1;

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel