There is a slight difference b/w delete and truncate statement. The DELETE statement only deletes the rows from the table based on the condition defined by WHERE clause or delete all the rows from the table when condition is not specified.
But it does not free the space containing by the sql table.
The TRUNCATE statement: it is used to delete all the rows from the sql table and free the containing space by the sql table.
The Example of DELETE a row from the sql table employee.
DELETE FROM employee WHERE emp_id=”10”;
The Example of DELETE all row from the sql table employee.
DELETE FROM employee;
The Example of TRUNCATE the sql table employee.
TRUNCATE TABLE employee;
My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.