SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Query Databases Using the SQL Console in SAP HANA Cloud Central

Learn how the SQL console can be used within SAP HANA Cloud Central to quickly query a selected database.

Overview

🎓 beginner 10 min. SAP HANA CloudBeginnerSAP HANA Cloud SAP HANA DatabaseSAP HANA Cloud Data Lake

You will learn

  • โœ”How to open a SQL console, specify the credentials, and set the current schema
  • โœ”An overview of the functionality provided in the SQL console

Prerequisites

Prerequisites

  • An SAP HANA Cloud database
  • You have completed this tutorial which creates a database schema for an SAP HANA Cloud, SAP HANA database.
  • You have completed this tutorial which creates a database schema for an SAP HANA Cloud, data lake Relational Engine

Steps

Step 1 Open a SQL console
โ€”

This step demonstrates how a SQL console can quickly be opened from within SAP HANA Cloud Central and how to change the SQL console’s credentials and schema.

  1. In SAP HANA Cloud Central open a SQL console by selecting SQL Console in the left pane. Notice that the SQL console is not associated with a database when opened in this way.

    open SQL console
    open SQL console

    Additional SQL consoles can also be opened by selecting the + icon.

  2. This time select Instances, select a database, and choose Open SQL Console from the actions menu.

    open SQL console from an instance
    open SQL console from an instance

    Notice that it is now connected to the instance named HC_HDB as shown by the name of the tab and the connection label or through the below SQL.

    SQL
    SELECT CURRENT_USER FROM DUMMY;

    SQL console connected to HC_HDB
    SQL console connected to HC_HDB

  3. If you wish to connect to the database using a different set of credentials, select the Connect to link, select the Connect … button and provide the new user name and password. Note that these credentials are not persisted.

    Change credentials
    Change credentials

    The Enter Credentials dialog will then ask for the new credentials to be used.

    change credentials
    change credentials

    You can also use the following SQL for an SAP HANA database to change the connected user.

    SQL
    CONNECT USER1 PASSWORD Password1;
    SELECT CURRENT_USER FROM DUMMY;

    Change credentials using SQL
    Change credentials using SQL

    The SQL to view the current user for a data lake Relational Engine is shown below.

    SQL
    SELECT CURRENT USER;

    Show current user for a data lake Relational Engine
    Show current user for a data lake Relational Engine

  4. The current schema can be set and viewed for a SAP HANA database using the SQL statements below.

    SQL
    SET SCHEMA HOTELS;
    SELECT CURRENT_SCHEMA, CURRENT_USER FROM DUMMY;

    Set the schema
    Set the schema

    For data lake Relational Engine instances, the current schema can be set and viewed as shown below.

    SQL
    SET SCHEMA HOTELS;
    SELECT CURRENT SCHEMA, CURRENT USER;

    set the schema of a data lake RE
    set the schema of a data lake RE

  5. Multiple light and dark themes are available.

    Click on the SAP HANA Cloud Central settings icon. Then select Settings > Appearance. The default theme is SAP Morning Horizon.

    available themes
    available themes

Step 2 Execute SQL
+
Step 3 Statement library
+
Step 4 GenAI in the SQL Console
+
Step 5 A few things to note
+
Step 6 Knowledge check
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 6
1. Open a SQL console 2. Execute SQL 3. Statement library 4. GenAI in the SQL Console 5. A few things to note 6. Knowledge check

Learn more →