Was this helpful?
DELETE Examples
1. Delete from the sales_fact table where the year is last year:
CREATE TABLE sales_fact (
    sales_date ANSIDATE,
    value INTEGER2,
    quantity FLOAT8);
INSERT INTO sales_fact VALUES ('2013-02-28', 120, 23.8),('2014-04-30', 1, 3.8),('2012-08-14', 30, 44.0),('2013-11-01', 1, 19.4),('2012-10-12', 3, 14.4);
DELETE FROM sales_fact WHERE year(sales_date) = year(CURRENT_DATE);
One row will be deleted.
2. Delete all rows from sales_fact:
DELETE FROM sales_fact;
Last modified date: 12/19/2024