Home » » TRUNCATE Syntax

TRUNCATE Syntax

Written By 1 on Sunday, October 14, 2012 | 4:04 AM

Truncate a table means delete all the rows

Truncate a table
TRUNCATE TABLE users

Keep in mind following things regarding the truncate.

  • Truncate drop the table and re-create the table, which is much faster than deleting rows one by one.
  • Truncate operations are not transaction-safe; you will get an error if you have an active transaction or an active table lock.
  • The number of deleted rows is not returned.
  • As long as the table definition file `users.frm' is valid, the table can be re-created this way, even if the data or index files have become corrupted.
Numeric Truncate Function
  select truncate(10/3,2)

Output: 3.33
the numeric function "truncate" do the calulation (10/3) ratio into 2 decimal places.

0 Comment:

Post a Comment