DELETE & TRUNCATE commands - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > 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, 04:52 AM   #1 (permalink)
Member
 
Join Date: Jul 2009
Posts: 160
Default DELETE & TRUNCATE commands

What is difference between DELETE & TRUNCATE commands?
gkumar is offline   Reply With Quote
Sponsored Links
Advertisement
 
Old 02-14-2017, 08:12 AM   #2 (permalink)
Regular User
 
Join Date: Feb 2017
Location: Ahmedabad
Posts: 16
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
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 12:46 PM.


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