Mentor SAP

SAP HANA SQL Types

When managing database tables on the SQL level, it is important to know the data type system provided by SAP HANA on the SQL level. These are outlined in the following table:

 

Numerical Data types:

 

String/Character Data types:

 

Data Types for Date and Time

 

Data Types for Binary Data and Large Objects

 

Create Database Tables

In ANSI SQL, the statement to create a new database table is CREATE TABLE….SAP HANA supports two types of table stores: row store and column store. As a result, SAP HANA SQL extends the ANSI syntax to control whether a new table is created in the row store or in the column store. This leads to the following basic syntax:

CREATE [ROW|COLUMN] TABLE <Table Name> (
<column name> <SQL data type> [Primary Key]
<column name> <SQL data type> [NULL| NOT NULL]
<column name> <SQL data type> [DEFAULT <default value>],
[PRIMARY KEY (<column list>) ]  [UNIQUE (<column list>)]
)

 

 

 

 

 

Changing Database tables

Once a table has been defined, you can modify it in certain ways using the ALTER TABLE statement. The statement is always followed by the name of the table to be changed, and one of the following additional keywords to indicate the type of change:

 

 

 

Renaming a Column

You can also rename an existing table column. This is not achieved using an ALTER TABLE statement but using a RENAME COLUMN statement.

 

Renaming a Table

 

Removing a Table