Skip to Content
Apache Hive Cookbook
book

Apache Hive Cookbook

by Hanish Bansal, Saurabh Chauhan, Shrey Mehrotra
April 2016
Beginner content levelBeginner
268 pages
5h 32m
English
Packt Publishing
Content preview from Apache Hive Cookbook

Dropping tables

In this recipe, you will learn how to drop a table in Hive.

Getting ready

DROP TABLE command removes the table from the database, including the data from the table. This is equivalent to the SQL DROP command, but the only difference is that the data is moved to the Trash folder in the home directory (if Trash is configured). If Trash is not configured, data is removed from the filesystem as well and is lost forever.

Note

In the case of an external table, data remains in the filesystem even if the table is dropped from the database.

The general format of using the DROP TABLE command is as follows:

DROP TABLE [IF EXISTS] table_name [PURGE];

Where:

  • [IF EXISTS]: Is an optional clause. If not used, an error is thrown when there is an attempt ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Introduction to Apache Hive

Introduction to Apache Hive

Tom Hanlon

Publisher Resources

ISBN: 9781782161080Supplemental Content