sparker
  • Hello
  • Intro
  • Hadoop
  • Hive
    • Intro
    • File Formats
    • Internal and External tables
    • SQL
      • Beginner
      • Advanced
    • Partitioning and Bucketing
    • Performance Optimisation
    • Compression Techniques
    • Misc
  • Spark
    • Real relief
  • Streaming
    • Kafka
  • No-SQL
  • Fancy Databases
  • Cloud
  • Airflow
  • DevOps
  • K8s
    • My_cheatSheets
  • Languages
    • scala
    • Python
    • Golang
    • Julia
    • R
  • Developer's Nation
  • k-no-w me
Powered by GitBook
On this page

Was this helpful?

  1. Hive

Internal and External tables

Internal Tables:

  • Managed by Hive, meaning Hive controls the lifecycle of the data.

  • Data is stored in the Hive warehouse directory.

  • Dropping an internal table deletes both the table schema and the data.

CREATE TABLE internal_table (
    id INT,
    name STRING,
    age INT
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;

External Tables:

  • Managed by the user, meaning the user controls the lifecycle of the data.

  • Data is stored at an external location specified by the user.

  • Dropping an external table only deletes the table schema, not the data.

CREATE EXTERNAL TABLE external_table (
    id INT,
    name STRING,
    age INT
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/path/to/external/data';
PreviousFile FormatsNextSQL

Last updated 7 months ago

Was this helpful?