Although they sound similar, SQL and SQLScript have different functions. Both are beneficial when working with SAP HANA. In this blog post, we’ll discuss the differences between the two.
SQL vs. SQLScript: The Basics
SQL is a database language for defining data structures in relational databases. It’s also used for modifying – inserting, updating, deleting, etc. – data and querying data. The SQL language is used in applications to communicate with the database by sending individual statements one after the other.
Traditionally, SQL statements are divided into three categories: data manipulation language (DML), data definition language (DDL), and data control language (DCL). DML includes all statements that read or update the dataset in the database tables. Most applications only use DML statements during operations. DDL is used to define the data model, which is usually done during the development, installation, or upgrade of an application. Lastly, DCL is responsible for assigning read and write authorizations. These statements are therefore relevant for database administration.
SQL doesn’t provide a way to bundle multiple statements or define a flow logic, which leads many database providers to extend the SQL standard for their products to include these capabilities. Companies like Oracle and IBM have developed their own enhancements for the SQL language. Similarly, SQLScript is SAP’s enhancement of the ANSI SQL standard for the SAP HANA database. These languages provide a way for blocks of statements to be stored as functions or procedures and executed repeatedly.
SQLScript enhancements to the SQL standard affect the following areas:
- Procedures, functions, and anonymous blocks as logical containers for the SQLScript code.
- Extension of data types by table types without corresponding database tables.
- Declarative logic to formulate complex, but still high-performance, database queries.
- Imperative logic for flow control such as IF/ELSE or FOR loops.
As a result of these SQLScript enhancements, SQL statements are embedded directly in the SQLScript code. Together, they form a language ready to use with SAP HANA.
By creating reusable procedures and functions, programmers can delegate even larger tasks to the database that go beyond the execution of a single SQL statement. SAP has dubbed this technique the code-to-data paradigm. With this paradigm, complex and data-intensive calculations can be performed directly in the database, thus saving the cost of copying the data to the application server.
About the SQLScript for SAP HANA book
Mastering a new language like French or Spanish takes time – and learning resources! Programming languages like SQLScript are no different, which is why we published SQLScript for SAP HANA for programmers.
Begin with an overview of SAP HANA and its use as a column-based, in-memory database, as well as how to use it as an application server. Explore the different development environments, the organization of the development objects in the database catalog, and the SQL console.
Then, learn the basics of SQLScript! Discover logical containers, blocks, procedures, and functions, and learn how to write declarative SQLScript queries.
Explore the different data types for character strings and for date, time, timestamp, and numeric data. Also, understand SQL statements for read and write access to the database.
You’ll be introduced to sequence control via loops and conditions, and familiarize yourself with topics like dynamic SQL, transaction control, and error handling. You’ll create, modify, and delete database objects with SQLScript. You’ll also learn the concepts of sequences and triggers, which can play a role in the development of database-related applications.
Find out how you can use SAP HANA database objects, in particular SQLScript procedures and user-defined functions from within the ABAP programming language. After that, see how you can use SQLScript in SAP BW and SAP BW/4HANA is discussed.
Finally, learn to write clean SQLScript code that meets quality requirements and understand how to test and analyze your development objects.
Who Is This Book For?
This book is for anyone looking to learn how to write SQLScript code for SAP HANA. While readers of all skill levels can benefit from this book, programmers who are familiar with SQL will especially find this book useful when learning to read and write to the SAP HANA database.
About the Author
Jörg Brandeis is the managing director of Brandeis Consulting GmbH in Mannheim, which offers training and consulting for SAP BW/4HANA, SAP HANA and SQLScript. Until mid-2015, Mr. Brandeis worked as head of development at zetVisions AG in Heidelberg, where he was responsible for the development and architecture of the SAP NetWeaver-based products zetVisions CIM and SPoT. In this role, he worked extensively with agile development methods and clean code.
How to Purchase
If you’re interested in purchasing SQLScript for SAP HANA, follow this link and choose the format that works best for you: e-book, print edition, or bundle (both e-book and print).
If you want to continue learning about programming and SAP HANA, or if you want information on other upcoming books or special offers, make sure to sign up for our topic newsletters or our weekly blog recap.