How to run a hive query from the command line using hive -e command

Hive -e command

The Hive -e command is used to run the hive query in batch mode.Instead of enter into the Hive CLI and execute the query,We can directly execute the queries using Hive -e option from the command line itself.

Syntax of Hive -e command

Example for Hive -e option

Here we are running the select query for the hive table from the command line itself.Once we hit the enter after this command, the select query is executed successfully and returns the records of the table.

The query should be given within the double quotes to run using Hive -e command.


Hive -e example

Related Articles : Hive -f Command to run the queries from a file