0
0
Hadoopdata~10 mins

Hive architecture in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a Hive table named 'employees'.

Hadoop
CREATE TABLE employees (id INT, name STRING, department STRING, salary INT) [1];
Drag options to blanks, or click blank then click option'
ASTORED AS TEXTFILE
BDROP TABLE employees
CWHERE id > 10
DSELECT * FROM employees
Attempts:
3 left
💡 Hint
Common Mistakes
Using SELECT or WHERE clauses in CREATE TABLE statement
Forgetting to specify storage format
2fill in blank
medium

Complete the code to load data from HDFS path '/data/employees.txt' into the Hive table 'employees'.

Hadoop
LOAD DATA INPATH '[1]' INTO TABLE employees;
Drag options to blanks, or click blank then click option'
A/user/hive/warehouse/employees
B/data/employees.json
C/tmp/employees.csv
D/data/employees.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Using a directory path instead of the file path
Using a path that does not exist in HDFS
3fill in blank
hard

Fix the error in the Hive query to select all employees with id greater than 100.

Hadoop
SELECT * FROM employees WHERE id [1] 100;
Drag options to blanks, or click blank then click option'
A=
B>
C<
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>'
Using '=' which selects only id equal to 100
4fill in blank
hard

Fill both blanks to create a Hive query that counts employees grouped by department.

Hadoop
SELECT [1], COUNT(*) [2] employees GROUP BY [1];
Drag options to blanks, or click blank then click option'
Adepartment
BFROM
CWHERE
Demployees
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHERE instead of FROM
Not grouping by the selected column
5fill in blank
hard

Fill all three blanks to create a Hive query that selects employee names and salaries where salary is greater than 50000.

Hadoop
SELECT [1], [2] FROM employees WHERE [3] > 50000;
Drag options to blanks, or click blank then click option'
Aname
Bsalary
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting wrong columns
Using incorrect column in WHERE clause