- Impala - Query Language Basics
- Impala - Shell
- Impala - Architecture
- Impala - Environment
- Impala - Overview
- Impala - Home
Database Specific Statements
Table Specific Statements
- Impala - Drop a View
- Impala - Alter View
- Impala - Create View
- Impala - Show Tables
- Impala - Truncate a Table
- Impala - Drop a Table
- Impala - Alter Table
- Impala - Describe Statement
- Impala - Select Statement
- Impala - Insert Statement
- Impala - Create Table Statement
Impala - Clauses
- Impala - Distinct Operator
- Impala - With Clause
- Impala - Union Clause
- Impala - Offset Clause
- Impala - Limit Clause
- Impala - Having Clause
- Impala - Group By Clause
- Impala - Order By Clause
Impala Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Impala - Select a Database
Once you get connected to Impala, it is required to select one among the available databases. The USE DATABASE Statement of Impala is used to switch the current session to another database.
Syntax
Following is the syntax of USE Statement.
USE db_name;
Example
Following is an example of USE statement. First of all, let us create a database with the name sample_database as shown below.
> CREATE DATABASE IF NOT EXISTS sample_database;
This will create a new database and give you the following output.
Query: create DATABASE IF NOT EXISTS my_db2 Fetched 0 row(s) in 2.73s
If you verify the pst of databases using the SHOW DATABASES statement, you can observe the name of newly created database in it.
> SHOW DATABASES; Query: show DATABASES +-----------------------+ | name | +-----------------------+ | _impala_builtins | | default | | my_db | | sample_database | +-----------------------+ Fetched 4 row(s) in 0.11s
Now, let’s switch the session to the newly created database (sample_database) using the USE Statement as shown below.
> USE sample_database;
This will change the current context to sample_database and display a message as shown below.
Query: use sample_database
Selecting a Database using Hue Browser
On the left-hand side of the Query Editor of Impala, you will find a dropdown menu as shown in the following screenshot.
If you cpck on the dropdown menu, you will find the pst of all the databases in Impala as shown below.
Simply select the database to which you need to change the current context.
Advertisements