Interview Questions
Tables and Packages
-
Tables are defined as the set of rows and columns that constitute an integral part of the database. In this context, it defines the data storage table of SAP HANA database system. These tables in SAP HANA database system can be accessed in SAP HANA studio by accessing ‘Catalogue’ tab in Schemas.
How to create new tables in SAP HANA studio?
Below are the two simple methods that can be used to create database tables in the SAP HANA studio,
- With the help of SQL editor in SAP HANA Studio
- Using GUI option in SAP HANA Studio
Table Type
Table types are defined as database tables which do not have any instances. These table types play an important role in representing tabular results by defining it procedure parameters.
How to create table types in SAP HANA Studio?
We can create table types in the SAP HANA studio with the help of SQLScript, A table type is created using statement CREATE TYPE and can be deleted using statement DROP TYPE. Following are the general syntax for creating and deleting table types in SAP HANA Studio,
General Syntax:
CREATE TYPE [schema.]name AS TABLE
(name1 type1 [, name2 type2,...])
DROP TYPE [schema.]name [CASCADE]
Example:
After opening the SAP HANA Studio, write the below SQLScript and run them to create a new table,
CREATE TYPE Sales_Details.TT_SALES AS TABLE (
SALES_AMOUNT DECIMAL,
NET_AMOUNT DECIMAL,
PRODUCT_NAME NVARCHAR(20),
REGION_NAME NVARCHAR(20),
SUB_REGION_NAME NVARCHAR(20)
);
Where Sales_Details is the name of the table types.
Once the above script is executed, you can find the newly created table Sales_Details under Procedures -> Table Types section. You fetch the definition of the created table type by double clicking on it.
SAP HANA Packages
Any related content objects present in the SAP HANA Studio can be grouped under the name of packages in the SAP HANA Studio. These Packages are available under the Content Tab in the SAP HANA Studio. There are two different types of packages available in the SAP HANA, They are,
Package Type
Package Description
Structural
Package only contains sub-packages. It cannot contain repository objects.
Non-Structural
Package contains both repository objects and sub-packages.
How to create new SAP HANA packages?
New packages can be created in the SAP HANA Studio by right clicking on the Content Tab and Selecting Packages under the New option.
You can also create a Sub Package under a Package by right clicking on the Package name. When we right click on the Package we get 7 Options: We can create HANA Views Attribute Views, Analytical Views, and Calculation Views under a Package.
You can also create Decision Table, Define Analytic Privilege and create Procedures in a Package.
When you right click on Package and click on New, you can also create sub-packages in a Package. You have to enter Package Name, Description while creating a Package.
Get in touch with training experts Get Free Quotes