Showing create table

In this recipe, you will learn how to see the create statement of a table in Hive.

Getting ready

This command shows the CREATE TABLE statement of a table. The general syntax for showing the CREATE TABLE statement is as follows:

SHOW CREATE TABLE ([db_name.]table_name|view_name);

Where:

[db_name.]: Is an optional clause. This is used when you want to see the CREATE TABLE statement of a table from a different database.

How to do it…

Use the following commands to show CREATE TABLE in Hive:

  • This command will show the CREATE TABLE statement for the Sales table:
    Show create table Sales;
    
  • This command will show the CREATE TABLE statement for the Sales table under the Hive_learning database:
    Show create table Hive_learning.Sales;
    

Get Apache Hive Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.