Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL TRUNCATE

The TRUNCATE command deletes all records from a table.

TRUNCATE is similar to DELETE but executes much faster and more efficient.

TRUNCATE cannot be used when a foreign key constraint prevents deletion.

Example

#

Delete all Supplier records.

TRUNCATE TABLE Supplier

This type of operation may not complete, because of referential integrity constraints.

Result:  29 records deleted

Syntax

TRUNCATE syntax.

TRUNCATE TABLE table-name

You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.