Deleting Data from a Table
Expired data may need to be deleted from a table being used. In this case, you must delete the entire row from the table.
In SQL, you can only access and delete an independent row by declaring conditions. If a table has a primary key, 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, delete all the rows whose c_customer_sk column is 3869 from the table customer_t1.
1
|
gaussdb=# DELETE FROM customer_t1 WHERE c_customer_sk = 3869; |
Run the following command to delete all rows from the table:
1
|
gaussdb=# DELETE FROM customer_t1; |
Or
1
|
gaussdb=# TRUNCATE TABLE customer_t1; |

If you need to delete an entire table, you are advised to use the TRUNCATE statement rather than DELETE.
Delete the created table.
1
|
gaussdb=# DROP TABLE customer_t1; |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.