Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

TRUNCATE

Name

TRUNCATE -- Empties the contents of a table.

Synopsis

TRUNCATE [ TABLE ] name

Parameters

name

The name of the table you wish to truncate. To truncate a table means to remove all rows from the table.

Results

TRUNCATE

The message returned if the specified table is successfully truncated.

ERROR: Relation 'name' does not exist

The error returned if the specified table name does not exist in the connected database.

Description

Use this command to remove all rows of a specified table. It does not scan through the table before removing data, making it rather helpful when emptying large tables of data. In essence, it is a quicker form of the DELETE command.

Example

This example empties all of the rows in the temp_emp table:

booktown=# TRUNCATE TABLE temp_emp;
TRUNCATE

 
 
  Published courtesy of O'Reilly Design by Interspire