Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Hive Cookbook

You're reading from   Apache Hive Cookbook

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher Packt
ISBN-13 9781782161080
Length 268 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Preface 1. Developing Hive FREE CHAPTER 2. Services in Hive 3. Understanding the Hive Data Model 4. Hive Data Definition Language 5. Hive Data Manipulation Language 6. Hive Extensibility Features 7. Joins and Join Optimization 8. Statistics in Hive 9. Functions in Hive 10. Hive Tuning 11. Hive Security 12. Hive Integration with Other Frameworks Index

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 to drop a table that does not exist in the database.

  • [PURGE]: Is an optional clause. If specified, the data is not saved in the Trash folder under the home directory and is lost forever.

How to do it…

Follow these steps to drop a table in Hive:

  • The...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime