Example 1
Remove all rows from a staging table, then verify it is empty
After truncating, the staging table contains zero rows. The follow-up SELECT COUNT(*) confirms this. In SQLite the equivalent is DELETE FROM staging with no WHERE clause. For tables with foreign key references, some engines require disabling foreign key checks or truncating in dependency order before truncating the referenced table.
CREATE TABLE staging (id INT, VALUE VARCHAR(50));
INSERT INTO
staging (id, VALUE)
VALUES
(1, 'pending'),
(2, 'pending'),
(3, 'pending');TRUNCATE TABLE staging;
SELECT
COUNT(*) AS row_count
FROM
staging;| row_count |
|---|
| 0 |
SQLite uses DELETE FROM instead of TRUNCATE. All engines produce the same result: an empty table with row_count = 0.