SQL TRUNCATE Syntax – Listed by DBMS

This article lists the SQL TRUNCATE syntax, as implemented by various database management systems (DBMSs). The syntax is listed exactly as each vendor has listed it on their website. Click on the applicable link to view more detail about the syntax for a particular vendor.

The DBMSs covered are MySQL, SQL Server, PostgreSQL, and Oracle Database.

MySQL

From the MySQL 5.7 Reference Manual:

TRUNCATE [TABLE] tbl_name

SQL Server

From the Transact-SQL Reference.

Note that in SQL Server, the statement is actually called TRUNCATE TABLE.

TRUNCATE TABLE   
    [ { database_name .[ schema_name ] . | schema_name . } ]  
    table_name  
    [ WITH ( PARTITIONS ( { <partition_number_expression> | <range> }   
    [ , ...n ] ) ) ]  
[ ; ]  
  
<range> ::=  
<partition_number_expression> TO <partition_number_expression>

PostgreSQL

From the PostgreSQL 9.5 Manual:

TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ]
    [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]

Oracle Database

From the Oracle Database Online Documentation 12c Release 1 (12.1):

TRUNCATE TABLE [schema.] table
  [ {PRESERVE | PURGE} MATERIALIZED VIEW LOG ]
  [ {DROP [ ALL ] | REUSE} STORAGE ] [ CASCADE ] ;

About the TRUNCATE Statement

The TRUNCATE statement (or in the case of SQL Server, the TRUNCATE TABLE statement ) is a data manipulation language (DML) statement that quickly removes all rows from a table or specified partitions of a table.

It is similar to the DELETE  statement with no WHERE  clause; however, TRUNCATE is faster and uses fewer system and transaction log resources.