Using Tables in HANA DB



SAP HANA is an in-memory database that supports all the features of a conventional database. You can perform all DDL, DML, and DCL statements on database objects. Users can create new tables, views, functions, triggers, and all other database functions using HANA Studio front-end.

Tables in HANA database can be accessed from HANA Studio in Catalogue tab under Schemas. New tables can be created using the following two methods −

  • Using SQL editor
  • Using GUI option

All the database objects - tables, views, and other objects can be used to design a Universe - Data Foundation layer and later to publish Business Layer to BO repository for BI reporting.

How to Access the SQL Editor?

In SAP HANA Studio, open SQL editor by selecting the Schema name and click the circled option in the following screenshot. You can run all SQL queries in SQL editor, which are required to perform conventional database functions. You can create new tables, views by writing the CREATE command in the editor window or right-click the Schema name and write the following Create script.

SQL Editor

Following is the Create table SQL command that can be used to create a column table in HANA database.

Create column Table Sample1 (
   Cust_ID INTEGER,
   Cust_NAME VARCHAR(10),
   PRIMARY KEY (Cust_ID)
);
Create Table

To insert the data, run the Insert statement in SQL editor. "Sample" is the table name.

Insert into Sample Values (101,'Jon');
Insert into Sample Values (201,'Tina');
Insert into Sample Values (301,'Jacob');

When the data is entered, you can see the data in this row-based table by going to Data Preview option. To see the data, right-click the table name → Open Data Preview.

Open Data Preview

All the database objects in SAP HANA system are maintained in CATALOG folder in HANA Studio. Following are the key capabilities of SAP HANA database system −

  • You can use high performance in-memory database for processing complex transactions and analytics. You can manage large database volumes in multitenant database containers.

  • SAP HANA system combines OLAP and OLTP processing into a single in-memory database. It removes the disk bottlenecks, offering groundbreaking performance.

  • Using SAP HANA in-memory database component, you can run advanced analytical queries, which are complex in nature with high-speed transactions to get the correct, up-to-date responses in a fraction of a second.

Advanced Analytical Queries

All the 2-dimensional objects exist in schemas in HANA database. Schemas are shown under the Catalog folder in HANA Studio. When you expand any of the schema, you can see different Relational objects - functions, indexes, views, and synonyms inside it.

Catalog Folder

If you open SAP HANA cockpit using the following link, you can see different database functions in HANA system: https://best:4303/sap/hana/admin/cockpit

How to Create a View in HANA DB?

To create a view in one table, write the following SQL statement.

create view view_name as

select ARTICLE_ID,ARTICLE_LABEL,CATEGORY,SALE_PRICE
from "AA_HANA11"."ARTICLE_LOOKUP";
Create View HANA DB

Dropping a View

You can drop a view using the Drop command, like we drop a table.

Drop view "AA_HANA11"."DEMO_TEST";
Dropping View
Advertisements