Impala Select a Database Using Hue Browser

Keeping you updated with latest technology trends, Join DataFlair on Telegram

1. Objective

While working on Impala, it is essential to select one database among the available databases. So, in this article “Introduction to Impala Select a Database”, we will learn what we mean by Impala Select a Database. Afterward, we will learn its syntax, usage as well as an example to understand it well.
So, let’s know how Impala Select a Database.

Impala Select a Database using Hue Browser

Impala Select a Database using Hue Browser

2. How Impala Select a Database

The word “Select a Database”, means we need to select one among the available databases, as soon as we get connected to Impala. So, in order to switch the current session to another database, we use The USE DATABASE Statement of Impala.
Do you know How Impala CREATE TABLE Statement

If these professionals can make a switch to Big Data, so can you:
Rahul Doddamani Story - DataFlair
Rahul Doddamani
Java → Big Data Consultant, JDA
Follow on
Mritunjay Singh Success Story - DataFlair
Mritunjay Singh
PeopleSoft → Big Data Architect, Hexaware
Follow on
Rahul Doddamani Success Story - DataFlair
Rahul Doddamani
Big Data Consultant, JDA
Follow on
I got placed, scored 100% hike, and transformed my career with DataFlair
Enroll now
Richa Tandon Success Story - DataFlair
Richa Tandon
Support → Big Data Engineer, IBM
Follow on
DataFlair Web Services
You could be next!
Enroll now

3. Impala USE Statement

Basically, we begin in a database named default, whenever we connect to an Impala instance. In order to switch to another database within an impala-shell session, Issue the statement USE db_name. Wherever any CREATE TABLE, INSERT, SELECT, or other statements act when you specify a table without prefixing it with a database name, is the current database.
i. Usage
There are some suitable situations in which Switching the default database is convenient, such as:

  • While we want to avoid qualifying each reference to a table with the database name like SELECT * FROM t1 JOIN t2 instead of SELECT * FROM db.t1 JOIN db.t2.
  • Also, in order to do a sequence of operations all within the same database. Like creating a table, inserting data, and querying the table.

Moreover, specify the option -d db_name for the impala-shell command, to issue a USE statement automatically or to start the impala-shell interpreter for a particular database. However,  without hardcoding a USE statement into the SQL source, we can use the -d option to run SQL scripts. Like setup or test scripts, against multiple databases.

4. A Syntax of Impala USE Statement

Here, is the syntax of USE Statement, below;

USE db_name;

Let’s Learn Impala GROUP BY Clause

5. Example of USE statement

Now, let’s understand it with the following example of USE statement.
So, create a database with the name sample_database, at first. Like below.
For Example,


Hence, it will create a new database. Further, it provides the following output;

Query: create DATABASE IF NOT EXISTS my_db2

Fetched 0 row(s) in 2.73s

Then, we can observe the name of the newly created database, through SHOW DATABASES statement,  while verifying the list of databases.


Query: show DATABASES
| name                  |
| _impala_builtins      |
| default               |
| my_db                 |
| sample_database       |
Fetched 4 row(s) in 0.11s
Read about Impala CREATE VIEW Statement
Further, using the USE Statement,  switch the session to the newly created database (sample_database).

> USE sample_database;

As a result, the current context will change to sample_database. Also, displays a message.

Query: use sample_database

6. Selecting a Database using Hue Browser

There are several steps we can follow, in order to Select a Database using Hue Browser, such as;

  • There is a drop-down menu On the left-hand side of the Query Editor of Impala.
  • Then after clicking on the drop-down menu, you will find the list of all the databases in Impala.
  • Further, select the database to which you need to change the current context.

This was all about Impala Select a Data Base. Hope you like our explanation.

7. Conclusion

As a result, we have seen the whole concept of Impala Select a Database. Still, if any query you want to ask regarding Impala Select a Database, please ask through the comment section.
See Also- Impala Alter Table
For reference

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.