You are on page 1of 4

SAP HANA - Modelling Sept 15 - @Focus

.....................................

HANA SQL

Categories (statements - commands)


DML - Data Manupulation Statements (SELECT, UPDATE, INSERT)
DDL - DATA DEFINATION LANGUAGE STATEMENTS ( CREATE, ALTER, DROP)
DCL - DATA CONTROL LANGUAGE STATEMENTS (GRANT, REVOKE)
TCL - TRANSACTION CONTROL LANGUAGE STATEMENTS (COMMIT, SAVEPOINT, ROLLBACK)

DDL STATEMENTS:

CREATE SCHEMA <SCHEMANAME>

CREATE : IS TO CREATE OBJECTS IN THE DATABASE


ALTER : ALTERS THE STRUCTURE OF THE DATABASE
DROP : DELETE OBJECTS FROM THE DATABASE
TRUNCATE - REMOVE ALL THE RECORDS FROM A TABLE.

DML STATEMENTS:

SELECT : RETRIVES DATA FROM THE DATABASE


INSERT : INSERTS DATA INTO A TABLE.
UPDATE : UPDATE EXISTING DATA WITHIN A TABLE.
DELETE : DELETES ALL RECORDS FROM THE TABLE.

DCL STATEMENTS:

GRANT : PROVIDES USERS ACCESS PREIVILEGES TO DATA IN DATABASE OBJECTS


REVOKE : WITHDRAWS ACCESS PRIVILEGES GIVEN WITH GRANT COMMAND.

TCL STATEMENTS:
COMMIT : SAVE THE WORK/OR COMMITS COMMANDS UPTO COMMIT COMMAND EXECUTES
SAVE POINT : BOOKMARK, POINT IN THE TRANSACTION TO WHICH WE CAN LATER ROLL
BACK.
ROLLBACK : RESTORE DATABASE TO ORIGINAL SINCE THE LAST COMMIT

SAP HANA DATA TYPES:


....................

DATE AND TIME


DATE
TIMESTAMP
TIME

NUMERIC
INTEGER
DECIMAL
FLOAT
TINYINT
SMALLINT
BIGINT
STRING
CHAR
VARCHAR
NVARCHAR

BOOLEAN
TRUE/FALSE

LOB - LARGE OBJECT [LARGE ABOMOUNT OF BINARY DATA]


CLOB - ASCII CHARACTER LARGE OBJECT

HANA OPERATORS:
...............

ARTHEMATIC OPERATORS
STRING OPERATOR
COMPARISION
LOGICAL
SET OPERATORS

ARTHEMATIC
ADDITION
SUB
MUL
DIV

STRING

||

COMPARISION OPERATOR

=
>=
<=
<>

LOGICAL OPERATORS

AND
OR
NOT

SET OPERATORS:

UNION
UNION ALL
INTERSECT
EXCEPT
SYNTAX
CREATE SCHEMA <SCHEMA>

TABLE

CREATE COLUMN TABLE <SCHEMANAME>.<TABLENAME>


(
-- STRUCTURE
COL1 DATATYPE(LENGTH)
COL2 DATATYPE(LENGTH)

INSERT SYNTAX
INSERT INTO <SCHEMANAME>.<TABLENAME> VALUES (COL1, COL2) [IF STRING DATA THEN USE
QUOTS]

DATA BASE VIEWS:

JOINS

TYPES OF JOINS
1. INNER JOIN
2. LEFT OUTER JOIN
3. RIGHT OUTER JOIN
4. FULL OUTER JOIN

5. REFRENTIAL JOIN
6. TEXT JOIN