Advanced SQL for DB2 (DB1041)

Request a Quote for this class

About this Course

Get ready to go deep with Structured Query Language (SQL) and become a power user. Whether you are being asked to solve complicated problems with SQL or you need to read and understand complex SQL that is already written, this course is for you! Come prepared to master Structured Query Language (SQL) on the DB2 platform in this fast paced and hands-on course. We begin with an in-depth discussion of joins and move quickly to more complex operations involving set processing, grouping, subqueries, table expressions, recursion and more. Each topic is reinforced with hands-on workshops.

The SQL covered in this course will work across the DB2 family of products.

Note: The topics covered in this course are also covered in Themis course SQ1010: Cross Platform SQL – Dealing with Complex Queries.

Audience Profile

Programmers, Analysts, Database Administrators, and IT Managers who are exposed to, or are required to interact with data in DB2 databases.

Prerequisites

DB1000 or equivalent experience.

Course Outline

1. Complex Joins

  • Inner Joins
  • LEFT and RIGHT Outer Joins
  • Full Outer Joins
  • "Anti" Joins
  • Self Joins

2. Multiple Query Blocks

  • Non-correlated Subqueries
  • Correlated Subqueries
  • Scalar Fullselects

3. Table Expressions and Views

  • Views
  • Nested Table Expressions
  • Common Table Expressions

4. Set Operations

  • UNION / UNION ALL
  • INTERSECT / INTERSECT ALL
  • EXCEPT / EXCEPT ALL

5. Advanced Grouping

  • GROUP BY Clause
  • HAVING Clause
  • Grouping Sets (ROLLUP & CUBE)
  • Aggregation Partitioning

6. Solving Complex Problems with SQL

  • Relational Difference
  • Quote Queries
  • Relational Division
  • Recursion
  • Complex CASE Statements
  • Table Pivoting

7. Managing Transactions and Units of Work

  • Data Modification Statements
  • COMMIT, ROLLBACK, and SAVEPOINT
  • When to COMMIT?
  • Checkpoint and Restart Considerations
  • Constraint Violations

8. Temporary Data

  • Global Temporary Tables
  • Materialized Query Tables