0
0
Hadoopdata~10 mins

Why Hive enables SQL on Hadoop - Test Your Understanding

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) [1];
Drag options to blanks, or click blank then click option'
ASTORED AS TEXTFILE
BSELECT * FROM employees
CINSERT INTO employees
DDROP TABLE employees
Attempts:
3 left
💡 Hint
Common Mistakes
Using SELECT or INSERT statements instead of storage format.
Omitting the storage format clause.
2fill in blank
medium

Complete the code to query all records from the 'employees' table.

Hadoop
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
Aname
Bid
CCOUNT(*)
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting only one column when all are needed.
Using aggregate functions without GROUP BY.
3fill in blank
hard

Fix the error in the Hive query to count employees.

Hadoop
SELECT COUNT([1]) FROM employees;
Drag options to blanks, or click blank then click option'
Aid
B*
Cname
Demployees
Attempts:
3 left
💡 Hint
Common Mistakes
Using table name inside COUNT instead of * or column.
Using a column that may have NULL values.
4fill in blank
hard

Fill both blanks to create a Hive query that filters employees with id greater than 100.

Hadoop
SELECT * FROM employees WHERE id [1] [2];
Drag options to blanks, or click blank then click option'
A>
B100
C<
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than operator instead of greater than.
Using wrong number for filtering.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps employee names to their ids if id is less than 200.

Hadoop
{ [3].[1]: [3].[2] for [3] in employees if [3].id < 200 }
Drag options to blanks, or click blank then click option'
Aname
Bid
Cemployee
Demp
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names in comprehension.
Mixing keys and values in the dictionary.