-
Select a connection and open the SQL console.
-
Notice that the database connection the SQL console is connected to is displayed and that toolbar items are shown after a left-click the … button. There are options to connect, disconnect, or change the connection.
-
Enter the SQL statements below.
SELECT * FROM HOTEL.HOTEL;
INSERT INTO HOTEL.HOTEL VALUES(24, 'River Boat', '788 MAIN STREET', 'New Orleans', 'LA', '79872'); --will cause a unique constraint error when executed
-
Expand the Run dropdown menu. Notice that there are multiple options along with their shortcut keys.
-
Choose Run to execute the SQL. The records from the HOTEL table are shown in the results tab.
The unique constraint violation error is expected and is used here to demonstrate how the results of SQL execution are shown.
-
The Messages tab displays information about the executed queries as well as any errors.
-
The History tab displays the last 50 successfully executed queries. A previously executed query can be searched for and recalled.
-
Reload the page. Notice that when the 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.
This behavior can be set via the SQL console preferences which is shown in more detail in Step 5: SQL console preferences.
-
Sometimes you need to execute a SQL statement that takes a long time to run–longer than you want to keep your browser open. 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.
-
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 button. A new SQL console will open displaying the SQL, the results, and any messages from the execution period.
-
The SAP HANA database explorer provides the ability to run a query against multiple databases.
-
The below dialog enables multiple databases to be selected.
-
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 button.
-
Returned results in HTML, XML, JSON, or binary can be displayed in a separate viewer. Enter the SQL statements below and execute the query.
SELECT
'{ "name":"John", "age":30, "cars": { "car1":"Ford", "car2":"BMW", "car3":"Fiat" }}'
AS JSON_EXAMPLE FROM DUMMY;
Choose View data to open a viewer.
-
The results of a query can be downloaded and exported.
