Challenge - 5 Problems
Hive Database and Table Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Hive query?
Consider the following Hive query to create a database and then list all databases. What will be the output of the
SHOW DATABASES; command?Hadoop
CREATE DATABASE IF NOT EXISTS sales_db; SHOW DATABASES;
Attempts:
2 left
💡 Hint
Think about what databases exist by default and what happens when you create a new one.
✗ Incorrect
The
CREATE DATABASE IF NOT EXISTS sales_db; command creates a new database named 'sales_db' if it does not already exist. The SHOW DATABASES; command lists all databases including the default one and the newly created 'sales_db'.❓ data_output
intermediate2:00remaining
How many tables are in the database after these commands?
Given the following Hive commands, how many tables will be listed in
sales_db?Hadoop
CREATE DATABASE IF NOT EXISTS sales_db; USE sales_db; CREATE TABLE IF NOT EXISTS customers (id INT, name STRING); CREATE TABLE IF NOT EXISTS orders (order_id INT, customer_id INT); SHOW TABLES;
Attempts:
2 left
💡 Hint
Count how many tables you created in the database.
✗ Incorrect
Two tables, 'customers' and 'orders', are created in the 'sales_db' database. The
SHOW TABLES; command lists both tables, so the count is 2.🔧 Debug
advanced2:00remaining
Identify the error in this Hive table creation command
What error will this Hive query produce?
Hadoop
CREATE TABLE employees (id INT, name STRING, salary);
Attempts:
2 left
💡 Hint
Check if all columns have data types specified.
✗ Incorrect
The column 'salary' does not have a data type specified, which causes a syntax error in Hive table creation.
🧠 Conceptual
advanced2:00remaining
What is the difference between EXTERNAL and MANAGED tables in Hive?
Choose the correct statement about EXTERNAL and MANAGED tables in Hive.
Attempts:
2 left
💡 Hint
Think about who manages the data files for each table type.
✗ Incorrect
MANAGED tables store data in Hive's warehouse directory and dropping them deletes data and metadata. EXTERNAL tables point to data stored outside Hive's control, so dropping them deletes only metadata, leaving data intact.
🚀 Application
expert3:00remaining
Which command creates a partitioned table in Hive?
You want to create a table named
sales partitioned by year and month. Which Hive command correctly creates this partitioned table?Attempts:
2 left
💡 Hint
Remember the syntax for partitioned tables in Hive: columns go first, then PARTITIONED BY clause.
✗ Incorrect
The correct syntax places the regular columns first, then uses PARTITIONED BY to specify partition columns separately.