Managed / Internal Tables – Hive owns the data, dropping the table deletes the table metadata and the actual data.
External tables – points at the data but does not own it. Dropping the table deletes the metadata, not the actual data.
The data for this table is taken from the UNICEF Report Card, which details childrens’ wellbeing in different countries. Here, the data looks at childrens’ wellbeing in rich countries, and you can read the report here.
In Hue, you need to be sure that you are pointing at the correct database.
On the left hand side, you will see a drop down list of databases.
We are going to choose the database ‘IncomeInequality’
The external table can be created using the following statement, which is terminated by a semi-colon “;”.
CREATE EXTERNAL TABLE IF NOT EXISTS UNICEFReportCard ( CountryName STRING, AvgRankPosition FLOAT, MaterialWellBeing FLOAT, HealthAndSafety FLOAT, EducationalWellBeing FLOAT, FamilyPeersRelationships FLOAT, BehavioursAndRisks FLOAT, SubjectiveWellBeing FLOAT) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’ LOCATION ‘/user/hue/UNICEF’;
This will return no data, but if it does not error, then we know that the table has been found.
Alternatively, you can click on the Beeswax (Hive UI) and then select the ‘Tables’ button.
Make sure you’ve selected the correct database, IncomeInequality, and then you will see the table on the right hand side.
DESCRIBE EXTENDED and then the name of the table, for example: