Download - hana 2.0 free learning
SQL Basics for SAP HANA
PARTICIPANT HANDBOOKINSTRUCTOR-LED TRAINING
Course Version: 12
Course Duration: 2 Day(s)
Material Number: 50135953
0For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
SAP Copyrights and Trademarks
© 2016 SAP SE or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://g loball2.sap.com/corporate-en/legal/ copyright/index.epx for additional trademark information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE's or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Typographic Conventions
American English is the standard used in this handbook.
The following typographic conventions are also used.
This information is displayed in the instructor’s presentation
Demonstration
Procedure
Warning or Caution
Hint
Related or Additional Information
Facilitated Discussion
User interface control
Window title
A
O»
Example text
Example text
© Copyright. All rights reserved.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
0
IV © Copyright. All rights reserved.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Contents
vii Course Overview
1 Unit 1: Motivation and Basic Concepts
2
15
Lesson: Understanding Motivation and Basic Concepts
Lesson: Understanding the Sample Data
21 Unit 2: Data From a Table Or View
22
47
Lesson: Using Data from a Table or View
Exercise 1: Using the SELECT Statement to Read from a Single
Table
53 Unit 3: Aggregation of Data
54
65
Lesson: Aggregating Data
Exercise 2: Use Aggregate Expressions
69 Unit 4: Data From Multiple Tables Part 1
70
91
Lesson: Reading Data from Multiple Tables- Part 1
Exercise 3: Use JOIN to Combine Data from Several Tables
95 Unit 5: Data From Multiple Tables Part II
96
107
Lesson: Reading Data from Multiple Tables- Part 2
Exercise 4: Use Nested Queries
111 Unit 6: NULL Values
112
117
Lesson: Understanding NULL Values
Exercise 5: Understand NULL Values
121 Unit 7: Data Stored in Tables
122
129
Lesson: Changing Data Stored in Tables
Exercise 6: Insert, Update, and Delete Rows in a Database Table
133 Unit 8: Data Storage
134
143
Lesson: Defining How Data is Stored
Exercise 7: Create, Change, and Delete a Database Table
149 Unit 9: Views For Data Access
150
157
Lesson: Using Views for Data Access
Exercise 8: Work with Database Views
© Copyright. All rights reserved. v
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
161 Unit 10: Functions and Procedures
162
167
173
178
185
191
192
201
202
Lesson: Creating User-Defined Functions
Exercise 9: Create and Call Scalar User-Defined Functions
Exercise 10: Create and Call Table User-Defined Functions
Lesson: Creating Database Procedures
Exercise 11: Create and Use a Database Procedure
Unit 11: Data Access
Lesson: Defining Data Access
Unit 12: Database Transactions
Lesson: Explaining Database Transactions
VI © Copyright. All rights reserved.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Course Overview
TARGET AUDIENCE
This course is intended for the following audiences:
• Application Consultant
• Development Consultant
• Technology Consultant
© Copyright. All rights reserved. VII
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
viii © Copyright. All rights reserved.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Lesson 1
Understanding Motivation and Basic Concepts 2
Lesson 2
Understanding the Sample Data 15
UNIT OBJECTIVES
• Understand the motivation for and foundation of the relational model
• Understand SQL and its relation to the relation model
• Understand database tables as the most important database objects
• Understand the sample database used throughout the course
© Copyright. All rights reserved. 1
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Unit 1
Lesson 1
Understanding Motivation and Basic Concepts
LESSON OVERVIEW
This lessons explains why learning SAP HANA SQL may be important and the relational
database model it originates from.
LESSON OBJECTIVES
After completing this lesson, you will be able to:
• Understand the motivation for and foundation of the relational model
• Understand SQL and its relation to the relation model
• Understand database tables as the most important database objects
Terms Database Management System, Database and Database System
The terms Database, Database System and Database Management System are frequently
used incorrectly and interchangeably:
■“What Database do you use?” ©
■“Which Database Management System do you use?” ©
■“We are using HANA as Database.” ©
■“We are using SAP HANA as Database Management System.” ©
■In everyday life, these terms are usually used incorrectly ...
Figure 1: Terms DB, DBS, and DBMS
The terms in fact refer to slightly different concepts:
Database (DB)
A database is a concrete structured collection of “ records” .
Database Management System (DBMS)
A database management system is software that manages databases. Every access to a
database (create, read, insert, update, delete) goes exclusively through the DBMS. The
DBMS exercises complete control over the database(s) it manages.
Database System
2 © Copyright. All rights reserved.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]