Home     SQL Basic     Contact Us     Site Map    

SQL BASIC

SQL SELECT

SQL WHERE

SQL DISTINCT

SQL AND

SQL OR

SQL NOT

SQL ORDER BY

SQL IN

SQL BETWEEN

SQL LIKE

SQL ALIAS

SQL AGGREGATE

>SQL COUNT

>SQL SUM

>SQL MAX

>SQL MIN

>SQL AVG

SQL GROUP BY

SQL HAVING

SQL INSERT

SQL UPDATE

SQL DELETE

SQL SELECT INTO

SQL CREATE DATABASE

SQL CREATE TABLE

SQL DROP TABLE

SQL DROP DATABASE

SQL CREATE INDEX

SQL PRIMARY KEY

SQL FOREIGN KEY

SQL ALTER TABLE

SQL TRUNCATE TABLE

SQL JOIN

SQL INNER JOIN

SQL OUTER JOIN

SQL CROSS JOIN

SQL UNION

SQL UNION ALL

SQL INTERSECT



SQL TRUNCATE TABLE

SQL DELETE statement can delete off all the rows inside a particular table. Other than that TRUNCATE also can use to delete all the records in a table.

TRUNCATE statement is use for Empty a table. And also reset all the storage parameters starting from Default. Example: some auto increasing number that set for some column will start from 1 if TRUNCATE TABLE statement used.

The main limitation of TRUNCATE is that you cannot use it on a table referenced by an enabled FOREIGN KEY constraint. And the TRUNCATE statement cannot be rollback. It’s very dangerous to use for an application

SQL syntax:

TRUNCATE TABLE [TABLE NAME]


EXAMPLE :

We want to TRUNCATE the table GameScores.

SQL Statement:

TRUNCATE TABLE GameScores