SAP HANA – SQL Overview
Purpose: SAP HANA – SQL Overview
SQL stands for Structured Query Language.
It is a standardized language for communicating with a database. SQL is used to retrieve the data, store or manipulate the data in the database.
SQL statements perform the following functions −
- Data definition and manipulation
- System management
- Session management
- Transaction management
- Schema definition and manipulation
The set of SQL extensions, which allow developers to push data into database, is called SQL scripts.
Data Manipulation Language (DML)
DML statements are used for managing data within schema objects. Some examples −
- SELECT − retrieve data from the database
- INSERT − insert data into a table
- UPDATE − updates existing data within a table
Data Definition Language (DDL)
DDL statements are used to define the database structure or schema. Some examples −
- CREATE − to create objects in the database
- ALTER − alters the structure of the database
- DROP − delete objects from the database
Data Control Language (DCL)
Some examples of DCL statements are −
- GRANT − gives user’s access privileges to database
- REVOKE − withdraw access privileges given with the GRANT command
Why do We Need SQL?
When we create Information Views in SAP HANA Modeler, we are creating it on top of some OLTP applications. All these in back end run on SQL. Database understands only this language.
To do a testing if our report will meet the business requirement we have to run SQL statement in database if Output is according to the requirement.
HANA Calculation views can be created in two ways – Graphical or using SQL script. When we create more complex Calculation views, then we might have to use direct SQL scripts.
How to open SQL console in HANA Studio?
Select the HANA system and click on SQL console option in system view. You can also open SQL console by right click on Catalog tab or any on any Schema name.
SAP HANA can act both as Relational as well as OLAP database. When we use BW on HANA, then we create cubes in BW and HANA, which act as relational database and always produce a SQL Statement. However, when we directly access HANA views using OLAP connection, then it will act as OLAP database and MDX will be generated.