From the course: Oracle Database 12c: Basic SQL

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Truncating all data from a table

Truncating all data from a table - Oracle Database Tutorial

From the course: Oracle Database 12c: Basic SQL

Start my 1-month free trial

Truncating all data from a table

- [Narrator] Another important Oracle SQL command you should be familiar with is the truncate command. Truncate is a DDL command which deletes all data in a given table. So let's start by seeing how many rows we have in our test table So I'll type select star from test table one. Running this command will show me that I currently have two records in my table. If I want to quickly delete all my records from my table, I can just type the truncate table test underscore table one command. This command is a DDL command, and not a DML command, and it will basically delete all records in the table. The difference between running truncate table versus a DML delete command is that because truncate is a DDL command, you cannot roll back the changes after it has been performed. So if I'll truncate all of the records in my test underscore table one database table, and let's verify that the table is now empty, typing rollback will have no affect whatsoever. As you can see, the table is still…

Contents