Chapter 10 Further Reading
IBM Documentation
-
DB2 SQL Reference — OLAP Specifications IBM Knowledge Center: OLAP specifications (window functions) https://www.ibm.com/docs/en/db2/11.5?topic=expressions-olap-specifications The authoritative reference for DB2's window function syntax, including all supported functions, frame types, and DB2-specific behaviors.
-
DB2 SQL Reference — Recursive Common Table Expressions IBM Knowledge Center: common-table-expression (recursive) https://www.ibm.com/docs/en/db2/11.5?topic=queries-common-table-expression Covers the full syntax, execution model, and restrictions for recursive CTEs in DB2 LUW.
-
DB2 Temporal Tables IBM Knowledge Center: Temporal tables https://www.ibm.com/docs/en/db2/11.5?topic=tables-temporal Comprehensive documentation on system-time, business-time, and bitemporal tables including DDL, DML behavior, and query syntax.
-
DB2 GROUP BY Extensions: ROLLUP, CUBE, and GROUPING SETS IBM Knowledge Center: group-by-clause https://www.ibm.com/docs/en/db2/11.5?topic=queries-group-by-clause Reference for ROLLUP, CUBE, GROUPING SETS, and the GROUPING() function.
Books
-
Itzik Ben-Gan, T-SQL Window Functions: For Data Analysis and Beyond, 2nd Edition (Microsoft Press, 2020) Although written for SQL Server, this is the definitive book on window function concepts. The theory — partitioning, ordering, framing — applies directly to DB2. Ben-Gan's explanations of ROWS vs. RANGE and default frame behaviors are unmatched.
-
Joe Celko, Joe Celko's Trees and Hierarchies in SQL for Smarties, 2nd Edition (Morgan Kaufmann, 2012) The essential reference for modeling and querying hierarchical data in SQL. Covers adjacency lists, nested sets, materialized paths, and closure tables — all alternatives and complements to recursive CTEs.
-
Tom Johnston and Randall Weis, Managing Time in Relational Databases (Morgan Kaufmann, 2010) A deep treatment of temporal data management theory and practice. Covers the conceptual foundations behind system-time and business-time that inform DB2's temporal table implementation.
-
C.J. Date, Hugh Darwen, and Nikos Lorentzos, Temporal Data and the Relational Model (Morgan Kaufmann, 2003) The theoretical foundation for temporal relational databases. Dense but authoritative — explains why temporal models work the way they do.
-
Sheryl M. Larsen, DB2 Developer's Guide, 6th Edition (IBM Press, 2017) Comprehensive DB2 for z/OS reference that includes detailed coverage of OLAP functions and analytical SQL. Useful for practitioners working in mainframe environments.
Articles and Papers
-
Markus Winand, "Window Functions" (use-the-index-luke.com) https://use-the-index-luke.com/sql/partial-results/window-functions An excellent practitioner-oriented explanation of how window functions are executed internally and their performance characteristics. Includes visualization of the logical execution model.
-
Markus Winand, SQL Window Functions Cheat Sheet https://modern-sql.com/caniuse — window functions compatibility matrix A cross-database comparison of window function support. Useful for understanding which features are DB2-specific vs. SQL standard.
-
Richard T. Snodgrass, "Developing Time-Oriented Database Applications in SQL" (Morgan Kaufmann, 2000) Available free online. The seminal work on temporal database design. Predates DB2's temporal table support but provides the conceptual framework that DB2's implementation follows.
-
IBM developerWorks — "Getting started with temporal data management in DB2" A tutorial-style introduction to DB2 temporal tables with step-by-step examples. Good supplement to the IBM Knowledge Center reference documentation.
Standards References
-
ISO/IEC 9075:2023 (SQL:2023) — Part 2: Foundation, Section 7.11: Window Functions The SQL standard specification for window functions. DB2 implements a substantial subset of this standard. Reading the standard helps distinguish portable SQL from DB2-specific extensions.
-
ISO/IEC 9075:2023 (SQL:2023) — Part 2: Foundation, Section 11.3: Temporal Tables The SQL standard for temporal table support. DB2's syntax aligns closely with the standard, particularly for system-time versioning.
Online Resources
-
DB2 for LUW Best Practices: OLAP Functions (IBM Redbooks) IBM Redbooks publications on DB2 analytical SQL. Includes performance tuning guidance for window functions at scale.
-
Stack Overflow — [db2] tag, filtered by "window functions" or "recursive CTE" A curated source of real-world DB2 window function questions and answers. Useful for seeing the variety of problems practitioners encounter and how they solve them.
-
Modern SQL (modern-sql.com) by Markus Winand https://modern-sql.com Regularly updated coverage of modern SQL features across database platforms. The window functions, CTEs, and temporal features sections are particularly relevant to this chapter.
Practice Datasets
-
IBM Sample Database (SAMPLE) DB2's built-in sample database includes tables suitable for window function practice. Create it with
db2samplon DB2 LUW. -
TPC-H Benchmark Dataset The TPC-H schema and data generator produce a realistic analytical workload. Many of the 22 TPC-H queries benefit from (or can be rewritten with) window functions — an excellent exercise for building fluency.
Recommended Reading Sequence
For readers who want to deepen their understanding beyond this chapter:
- Start with Markus Winand's online window functions material (free, visual, practical).
- Read Itzik Ben-Gan's window functions book for deep conceptual mastery.
- Study the IBM Knowledge Center temporal tables documentation for DB2-specific syntax.
- Read Johnston and Weis for temporal theory if your work involves regulatory compliance.
- Explore Joe Celko's hierarchies book if recursive CTEs become central to your data model.