Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
SAP HANA

Creating Database Schema and Table in SAP HANA

 

This tutorial explains to how to create a database schema and Database table in SAP HANA.

 

Schema:

Relational database system contains a catalog that describes various elements in the System. This Catalog divides the databases into sub-databases called Schema.

Schema enables you to logically group together database objects such as table, views and stored procedures.

 

Database Tables:

­­Database table are database objects which contains a specific structure. It allocates memory in the database and store data’s in them.

 

Procedure:

1. Create a HANA project and necessary development artifacts

2. Create a Database schema

3. Create a table in the Database schema.

 

Create a HANA Project with necessary development artifacts:

The mandatory artifacts for the HANA application is .xsapp (application descriptor ) and .xsaccess (application access) files.

Follow the instruction in the previous tutorials.

 

Create an HANA XS project.

clip_image001

 

Create the mandatory artifacts:

The xsapp file is empty and the xsaccess file contains the following code.

clip_image003

 

Create a file for database schema:

In the HANA project created, create a file with name of your choice and extension .hdbschema.

This is the file extension for the schema.

clip_image004

 

Enter the following code in the file.

clip_image005

 

Here we are specifying the name of the schema which is to be created. Upon activation on the file a Schema will be created in the underlying database.

 

Creating a database table:

In the schema we have created, let’s create a database table.

Right click on the project folder and click on create file. Create a file with table name of your choice and extension .hdbtable.

Enter the following code in the file.

clip_image007

 

Here we are specify the Schema in which table is to be created, Type of table, if it is column store or row store. Then we specify columns and keys of the table.

 

Granting privilege on Schema content:

Remember even if you have developed an artifact in a HANA it does not belongs to you. It always belongs to the user SYS_REPO. Hence for you to get access to the schema you need sufficient privilege to get access to the artifacts.

 

Share the project with HANA System. Save and activate the whole project to see the changes in the HANA System perspectives.

Go the HANA System perspective and click on the SQL Console.

Execute the following command to provide you privilege to access the schema you have created.

clip_image009

 

 

Now in the content folder of HANA System you will be able to see the schema you have created and the tables within them.

clip_image010

 

 

Now we have successfully created the Database schema and Tables.

In the next tutorial we will see how to load data into these tables from local machine using CSV files.

 

 

 

 

About Arun

0 Comments:

Post a Comment

Powered by Blogger.