课程: Hands-On Introduction: SQL

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Drop or truncate a table

Drop or truncate a table

- [Instructor] Let's learn about the three DDL statements that is drop, truncate, and rename. The first one is DROP statement. DROP statement will delete everything, the data and the structure of the table. It's auto committed, so changes made will be permanent. A person should have drop any table or he should be the creator of the table to drop the table. Now let's try one of these examples. Here, I want to drop the table dept_copy_tab table. First, let's take a look at the table in our database. So we have a table, empty table, which is dept_copy_tab. It does not have any rows. So now, I try to drop this particular table. Now let's take a look at the database. If we see, dept_copy_tab has been dropped. The next one is TRUNCATE statement. It'll delete all the rows from the table and it'll also release the storage space that was used by the table. You might say that we can just use the DELETE…

内容