DELETE & TRUNCATE commands - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Website Design and Development > Databases - MySQL, SQL, Oracle, Access and others

WebmasterForums.com is the premier Forum on the internet. Registered Users do not see the above ads.
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-31-2009, 03:52 AM   #1 (permalink)
Regular User
 
Join Date: Jul 2009
Posts: 160
gkumar is on a distinguished road
Default DELETE & TRUNCATE commands

What is difference between DELETE & TRUNCATE commands?
__________________
Web Development Company NY
Web Development
NYC Web Development Company
gkumar is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 02-14-2017, 07:12 AM   #2 (permalink)
Regular User
 
Join Date: Feb 2017
Location: Ahmedabad
Posts: 34
astaj.mathakiya is on a distinguished road
Default Re: DELETE & TRUNCATE commands

Hi,


When to use TRUNCATE

When you TRUNCATE a table less information is logged. This means the TRUNCATE statement executes very fast; however, it does so at the expense of not logging each row deleted. This means, that you need to be very careful when using the command (actually be careful with DELETE as well!).

Though you are able to rollback a TRUNCATE command in SQL Server, you can not do the same in Oracle.

The TRUNCATE command is simple yet extremely dangerous. Here is an example to remove all rows from the employee table:

When to use the DELETE command
The DELETE command is used to remove records from a database. It is the most common way to do so. In its simplest form you can remove all the rows from a database or you can add a WHERE clause to remove only those meeting the criteria.

When execute the DELETE command,the DBMS logs all removed rows. This means it is easier to recover from a mistake, than it would a mistaken TRUNCATE.

The command

DELETE FROM employee
Will remove all employees from the employee table; whereas,

DELETE FROM employee
WHERE firstName = ‘Kris’
deletes all employees whose first name is Kris.

Thanks
astaj.mathakiya is offline   Reply With Quote
Old 04-18-2017, 01:42 AM   #3 (permalink)
Junior Member
 
Join Date: Apr 2017
Posts: 8
mbahdien is on a distinguished road
Default Re: DELETE & TRUNCATE commands

truncate is drop and recreate table with preserving index but autoincement is gone and delete just empty row, autoincrement remain exists

Last edited by mbahdien; 04-18-2017 at 01:46 AM.
mbahdien is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisement

» Advertisement

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Advertisement

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 11:10 PM.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.1
User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Webmaster Forums
Web Hosting | Web Hosting