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 with the SQL Console in SAP HANA Database Explorer

Explore features of the SQL console and see how it facilitates querying an SAP HANA database.

Overview

🎓 beginner 15 min. SAP HANA CloudBeginnerSAP HANA Cloud SAP HANA DatabaseSAP HANASAP HANA Express Edition

You will learn

  • โœ”How to run SQL queries using the SQL console and add filters to the results
  • โœ”How to use different features of the SQL console including keyboard shortcuts, autocomplete, statement help, and the statement library
Unknown U Unknown May 11, 2026
Created by October 22, 2020
Contributors

Prerequisites

Prerequisites

  • An SAP HANA database such as SAP HANA Cloud trial or the SAP HANA, express edition that includes the SAP HANA database explorer
  • You have completed the first 3 tutorials in this group.

Steps

Step 1 Execute SQL
โ€”

  1. Select a connection and open the SQL console.

    open SQL console
    open SQL console

  2. Notice that the database connection the SQL console is connected to is displayed and that toolbar items are shown after a left-click on the icon. There are options to connect, disconnect, or change the connection.

    Connected SQL console
    Connected SQL console

  3. Enter the SQL statements below.

    SQL
    SELECT * FROM HOTEL;
    INSERT INTO HOTEL VALUES(24, 'River Boat', '788 MAIN STREET', 'New Orleans', 'LA', '79872', 
      NEW ST_POINT('POINT(-90.076919 29.957531)', 4326)); --will cause a unique constraint error when executed
  4. Expand the Run dropdown menu. Notice that there are multiple options along with their shortcut keys.

    run options
    run options

  5. Choose Run to execute the SQL. The records from the HOTEL table are shown in the results tab.

    result
    result

    The unique constraint violation error is expected and is used here to demonstrate how the results of SQL execution are shown.

    Unique constraint error
    Unique constraint error

  6. The results of a query can be downloaded and exported.

    Download Table Results
    Download Table Results

  7. The Messages tab displays information about the executed queries as well as any errors.

    Messages Tab
    Messages Tab

    For SAP HANA on-premise, if the peak memory consumed metric is not shown, follow the instructions at the end of the expensive statements trace step.

  8. The History tab displays the last 50 successfully executed queries. A previously executed query can be searched for and recalled.

    History Tab
    History Tab

  9. Reload the page. Notice that when the SAP HANA database explorer re-loads, the SQL console tab and the statements it has last run are shown, minus contents of the result, messages, and history tab.

    After reloading
    After reloading

    This behavior can be set via the SQL console preferences which is shown in more detail in Step 5: SQL console preferences.

  10. Sometimes you need to execute a SQL statement that takes a long time to run. In that case, you can run it as a background activity. This allows you to close your browser window and come back later to see the results of the statement. Enter the SQL statement below.

    SQL
    SELECT * FROM CUSTOMER;

    Run As Background Activity
    Run As Background Activity

    If needed, reconnect the database after running the query.

  11. To view the results of a query that was run in the background, open the Background Activities Monitor, select the query, and then choose the Open Details icon. A new SQL console will open displaying the SQL, the results, and any messages from the execution period.

    View Results
    View Results

  12. The SAP HANA database explorer provides the ability to run a query against multiple databases.

    Run Against Multiple Databases
    Run Against Multiple Databases

  13. The below dialog enables multiple databases to be selected.

    Database Groups
    Database Groups

  14. To view the results of a query run on multiple databases, open the Background Activities Monitor, select the query to view the result of, and then choose the Open Details icon or Download icon.

    Multiple Databases Result
    Multiple Databases Result

    The Download icon provides the results in a JSON document.

    Downloaded results
    Downloaded results

  15. Returned results in HTML, XML, JSON, extended well-known binary formatted spatial data, or binary data can be displayed in a separate viewer. Enter the SQL statements below and execute the query.

    SQL
    SELECT
    '{ "name":"John", "age":30, "cars": { "car1":"Ford", "car2":"BMW", "car3":"Fiat" }}'
    AS JSON_EXAMPLE FROM DUMMY;
    
    SELECT * FROM CUSTOMER FOR JSON;

    JSON Query Results
    JSON Query Results

    Choose View data to open a viewer.

    JSON Viewer
    JSON Viewer

    To see an example on viewing spatial data, see Try Out Multi-Model Functionality with the SAP HANA Database Explorer.

Step 2 Shortcuts
+
Step 3 Autocomplete
+
Step 4 Statement help panel
+
Step 5 SQL console preferences
+
Step 6 Statement library
+
Step 7 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 7
1. Execute SQL 2. Shortcuts 3. Autocomplete 4. Statement help panel 5. SQL console preferences 6. Statement library 7. Knowledge check

Learn more →