SQL TRUNCATE TABLE

Sometimes we wish to get rid of all the data in a table. One way of doing this is with DROP TABLE, which we saw in the last section. But what if we wish to simply get rid of the data but not the table itself? For this, we can use TRUNCATE TABLEcommand. The syntax for TRUNCATE TABLE is

 

 

So, if we wanted to truncate the table called a customer that we created in SQL CREATE, we simply type

TRUNCATE TABLE customer.