From the course: SQL Queries Made Easy

Unlock the full course today

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

Drop, rename, and truncate tables

Drop, rename, and truncate tables - SQL Tutorial

From the course: SQL Queries Made Easy

Start my 1-month free trial

Drop, rename, and truncate tables

- [Instructor] In this video, we will be learning about three other DDL statements, namely DROP, RENAME, and TRUNCATE. The first one is DROP statement. DROP statement will delete everything, the data and the structure of the table. All pending transactions will be committed. It's autocommit, so changes made will be permanent. A person should have drop any table privileges, or he should be the creator of the table to remove the table. Let's drop the table department_copy_tab. I give DROP TABLE dept_copy_tab. And then this is going to delete the table completely, and the structure as well. All the data in the table and the structure is gone. Let's try to fetch some data from the table and see what it says. Dept_copy_tab, and then run this. It says table or view does not exist because it's gone. Now, the second statement is RENAME statement. Using this, we can change the name of a table, view, synonym, or a sequence…

Contents