Clear a table
Tell the server that you want to:
- Remove all existing record(s) in a table
- Reset it’s cache (reset any incrementing keys, indexes, data space)
TRUNCATE TABLE <schema_name>.<table_name>;
IMPORTANT:
- Truncating will remove ALL existing data from a table. Check before committing!
- Not a pleasant feeling if done unintentionally!
stage_Product_Offers
Let's clear the stage_Product_Offers
in readiness for more CSV files in the future:
TRUNCATE TABLE "sequel-mart-schema"."stage_Product_Offers";
This removes every record from this table. All other tables are unaffected.
NOTE:
-
We could use the shorthand
TRUNCATE
instead ofTRUNCATE TABLE
TRUNCATE "sequel-mart-schema"."stage_Product_Offers";