Teradata DROP TABLE

The DROP TABLE statement removes an existing table along with data and table structure from the Teradata database. It removes the table structure from the data dictionary. As a result of the drop table, the table structure along with the data will be lost permanently.

Once a table is dropped, then the table cannot be recovered. So make sure, you are in the correct database before dropping a table.

Teradata DROP TABLE syntax

The syntax for Teradata DROP TABLE is as follows.

DROP TABLE database_name.tbl_name;

Here,

  • database_name – The name of the parent database where the table resides.
  • tbl_name – The name of the table you want to drop.

Note:- You should have DROP privileges on the table in order to drop the table.

Teradata DROP TABLE Example

You can drop a Teradata table in two ways.

Option 1:

The following statement drops the student table from the Teradatapoint database. Here, we are providing a fully qualified table name i.e. table name along with the database name.

DROP TABLE Teradatapoint.student;

Option 2:

Here we are first selecting the owner database and then issuing the DROP DATABASE statement.

DATABASE Teradatapoint;
DROP TABLE student;

The same table name can be present in different databases. So, we need to make sure that we have selected the correct database before executing the DROP TABLE statement.

Leave a Comment