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:
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;
|
Last Article: Viewing Data
Next Article: Loading Sample Data
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.