✕
ICT & Digital Skills

Advanced SQL Querying Training

Advanced SQL Querying Training equips data professionals and database practitioners with the deep technical skills needed to write complex, high-performance queries across enterprise database environments. Participants explore window functions, recursive CTEs, query optimisation, and advanced analytical techniques through hands-on, scenario-driven practice. By the end of the programme, delegates will confidently design, troubleshoot, and optimise SQL solutions that drive real business intelligence and reporting outcomes.

⏱ 10 Days 📡 In-Person 🎯 Advanced From KES 160,000

About This Course

Structured Query Language remains the backbone of modern data management, analytics, and business intelligence. Yet many professionals who use SQL daily have never fully explored the powerful advanced features that can transform slow, unwieldy scripts into elegant, high-performance solutions. TrainingComplex's Advanced SQL Querying Training is designed specifically for those who already know the basics and are ready to take their skills to the next level.

Over ten intensive days, participants move well beyond SELECT statements and simple joins. The programme covers the full spectrum of advanced querying capabilities — from complex subqueries and correlated queries to window functions, common table expressions, recursive queries, dynamic SQL, and sophisticated indexing strategies. Each concept is grounded in realistic business datasets drawn from finance, logistics, HR, and operations, ensuring that learning is immediately applicable.

A significant portion of the programme is dedicated to query performance tuning and execution plan analysis — skills that are increasingly in demand as organisations scale their data infrastructure. Participants will learn how database engines process queries, how to interpret execution plans, and how to apply proven optimisation techniques that cut query runtimes dramatically.

Whether you work with Microsoft SQL Server, PostgreSQL, MySQL, or Oracle, the core concepts and patterns taught in this course translate across platforms. TrainingComplex's expert facilitators bring years of hands-on database engineering experience, ensuring that every technique taught is rooted in real-world best practice. Delegates leave with a robust toolkit of advanced SQL skills, reusable query templates, and the analytical confidence to tackle any data challenge their organisation presents.

Who Should Attend

Learning Objectives

Course Modules

Module 1: Foundations Review and Advanced Query Architecture

  • Revisiting relational model concepts and how the SQL engine processes a query
  • Understanding logical vs. physical query processing order
  • Set-based thinking vs. procedural thinking in SQL
  • Establishing a consistent SQL coding style and readability standards
  • How the query parser, algebrizer, and optimiser interact before execution begins
  • Recognising how clause evaluation order affects filtering, aliasing, and aggregation results

Module 2: Advanced JOIN Strategies and Set Operations

  • Self-joins, cross joins, and their practical applications
  • Non-equi joins and range-based joining patterns
  • UNION, INTERSECT, and EXCEPT — correct use cases and performance implications
  • Handling duplicate rows and deduplication strategies with set operations
  • Multi-table join ordering and how the optimiser evaluates join permutations
  • Anti-join patterns using LEFT JOIN with NULL checks as an alternative to EXCEPT

Module 3: Subqueries and Correlated Subqueries

  • Scalar subqueries, row subqueries, and table subqueries in context
  • Correlated subqueries — mechanics, use cases, and performance trade-offs
  • EXISTS and NOT EXISTS vs. IN and NOT IN — choosing the right approach
  • Refactoring nested subqueries for clarity and performance
  • Lateral joins and APPLY operators as a modern alternative to correlated subqueries
  • Identifying when the optimiser unnests a subquery and when it executes row-by-row

Module 4: Common Table Expressions and Recursive Queries

  • CTE syntax, scoping, and readability advantages over subqueries
  • Chaining multiple CTEs in a single query for modular logic
  • Recursive CTEs — structure, termination conditions, and common pitfalls
  • Practical recursive CTE applications: hierarchies, date series, and graph traversal
  • Materialisation behaviour of CTEs and how it varies across database platforms
  • Using CTEs to isolate and unit-test intermediate result sets during query development

Module 5: Window Functions for Analytical Querying

  • OVER clause anatomy — PARTITION BY, ORDER BY, and frame specification
  • Ranking functions: RANK, DENSE_RANK, ROW_NUMBER, and NTILE
  • Offset functions: LAG, LEAD, FIRST_VALUE, and LAST_VALUE in time-series analysis
  • Aggregate window functions for running totals, moving averages, and cumulative distributions
  • Frame specification detail — ROWS vs. RANGE and the impact on boundary row inclusion
  • Combining multiple window functions in a single SELECT to avoid repeated scans

Module 6: Advanced Aggregation Techniques

  • GROUPING SETS — generating multiple aggregation levels in a single query
  • ROLLUP for hierarchical subtotals and grand totals
  • CUBE for full cross-tabulation and multi-dimensional aggregation
  • FILTER clause and conditional aggregation patterns for pivot-style reporting
  • Using GROUPING() and GROUPING_ID() to distinguish grand total rows from genuine NULL values
  • Performance comparison of GROUPING SETS against equivalent UNION ALL approaches

Module 7: Dynamic SQL and Parameterised Query Design

  • When and why to use dynamic SQL — appropriate use cases and security risks
  • Building and executing dynamic SQL safely with sp_executesql and parameterisation
  • Protecting against SQL injection in dynamic query construction
  • Dynamic pivot and unpivot patterns for flexible reporting outputs
  • Managing execution plan caching and parameter sniffing behaviour in dynamic SQL
  • Debugging dynamic SQL by capturing and printing generated statement text before execution

Module 8: Indexing Strategies and Execution Plan Analysis

  • B-tree index internals — clustered vs. non-clustered indexes and covering indexes
  • Reading and interpreting graphical and text-based execution plans
  • Identifying table scans, key lookups, and index seeks — and what they mean for performance
  • Index selection, composite index design, and when indexes hurt rather than help
  • Filtered indexes and computed column indexes for targeted query optimisation
  • Using missing index recommendations critically — evaluating DMV suggestions rather than applying them blindly

Module 9: Query Performance Tuning and Optimisation

  • Statistics, cardinality estimation, and how the query optimiser makes decisions
  • Query hints and plan guides — when to use them and when to avoid them
  • Identifying and eliminating common SQL anti-patterns: implicit conversions, functions on indexed columns, and SELECT *
  • Using wait statistics and query store data to diagnose performance issues in production
  • TempDB spills — identifying sort and hash join spills in execution plans and resolving them
  • Parameter sniffing — detecting plan reuse problems and remediation strategies including OPTIMIZE FOR and RECOMPILE

Module 10: Stored Procedures, Functions, and Triggers

  • Designing reusable stored procedures with input/output parameters and error handling
  • Scalar vs. table-valued functions — performance differences and best use cases
  • DML triggers — use cases, recursive trigger risks, and INSTEAD OF triggers
  • Encapsulating complex business logic safely within database objects
  • Transaction management within stored procedures — using TRY/CATCH with XACT_STATE for reliable rollback
  • Avoiding scalar function performance traps by refactoring to inline table-valued functions where possible

Module 11: Working with JSON and XML Data in SQL

  • Querying JSON data with JSON_VALUE, JSON_QUERY, and OPENJSON
  • Indexing and optimising queries against JSON columns
  • XML data type, XQuery expressions, and FOR XML clause patterns
  • Choosing between JSON and XML for semi-structured storage and integration scenarios
  • Shredding nested JSON arrays into relational rows using OPENJSON with explicit schema definitions
  • Using FOR JSON PATH and FOR JSON AUTO to generate structured JSON output directly from query results

Module 12: Advanced NULL Handling, Data Types, and Edge Cases

  • NULL propagation rules and three-valued logic in complex filter conditions
  • COALESCE, NULLIF, and ISNULL — correct application and subtle differences
  • Implicit vs. explicit data type conversion and the performance cost of mismatches
  • Date and time data types — timezone handling, precision, and common calculation errors
  • Character data type collation conflicts — how collation mismatches cause join failures and how to resolve them
  • Numeric precision and rounding edge cases with DECIMAL, FLOAT, and MONEY data types in financial calculations

Module 13: SQL Best Practices, Code Quality, and Capstone Project

  • SQL code review frameworks — readability, maintainability, and documentation conventions
  • Version control for SQL scripts using Git-based workflows in a team environment
  • Anti-pattern catalogue review and refactoring case studies
  • Capstone project: end-to-end optimisation and documentation of a complex multi-step analytical query
  • Establishing team query standards through linting tools and automated code analysis pipelines
  • Post-deployment validation techniques — comparing execution plans and row counts before and after production changes

Requirements & Prerequisites

Participants must have a working knowledge of core SQL concepts including SELECT, WHERE, GROUP BY, and basic JOINs — this course picks up from intermediate level and moves quickly into advanced territory. Familiarity with at least one relational database system such as Microsoft SQL Server, PostgreSQL, MySQL, or Oracle is expected. Experience writing SQL queries in a professional or academic context for at least six months is strongly recommended before attending.

Training Methodology

Organisational Benefits

Where Is Advanced SQL Querying Training Offered?

This course runs in-person across: Cape Town, Mombasa, Lagos, Dubai, Nakuru, Kigali, Naivasha, Johannesburg, Riyadh, Dar es Salaam, Kampala, Accra, Addis Ababa, Abuja, Zanzibar, Pretoria, Kisumu, Nairobi, Arusha, plus Live Virtual (online) cohorts. Browse live dates for your city below.

Upcoming Schedules

LocationFormatDatesPrice
Cape Town, South Africa In-Person 28 Sept 2026 – 9 Oct 2026 USD 7,600
Mombasa, Kenya In-Person 5 Oct 2026 – 16 Oct 2026 KES 230,000
Lagos, Nigeria In-Person 5 Oct 2026 – 16 Oct 2026 USD 5,000
Dubai, United Arab Emirates In-Person 12 Oct 2026 – 23 Oct 2026 USD 8,200
Nakuru, Kenya In-Person 12 Oct 2026 – 23 Oct 2026 KES 230,000
Kigali, Rwanda In-Person 19 Oct 2026 – 28 Oct 2026 USD 3,800
Cape Town, South Africa In-Person 19 Oct 2026 – 28 Oct 2026 USD 7,600
Naivasha, Kenya In-Person 19 Oct 2026 – 28 Oct 2026 KES 240,000
Johannesburg, South Africa In-Person 19 Oct 2026 – 28 Oct 2026 USD 7,000
Riyadh, Saudi Arabia In-Person 19 Oct 2026 – 28 Oct 2026 USD 9,000
Dar es Salaam, Tanzania In-Person 19 Oct 2026 – 30 Oct 2026 USD 4,600
Kampala, Uganda In-Person 19 Oct 2026 – 28 Oct 2026 USD 3,800
Accra, Ghana In-Person 19 Oct 2026 – 28 Oct 2026 USD 7,600
Live Virtual Online 24 Oct 2026 – 13 Dec 2026 KES 160,000
Addis Ababa, Ethiopia In-Person 26 Oct 2026 – 4 Nov 2026 USD 4,800

+238 more dates — view live schedule →

Frequently Asked Questions

Do I need prior SQL experience to attend this course?

Yes — this is an advanced-level programme designed for participants who already understand core SQL concepts such as SELECT, WHERE, GROUP BY, and JOINs. At least six months of practical SQL experience in a professional or academic setting is strongly recommended before enrolling.

Which database platform does the course use?

The core concepts and patterns covered are platform-agnostic and apply across Microsoft SQL Server, PostgreSQL, MySQL, and Oracle. Hands-on lab exercises are conducted primarily in Microsoft SQL Server and PostgreSQL, and facilitators highlight platform-specific syntax differences where relevant.

Will I receive a certificate upon completing the course?

Yes. Participants who attend and complete the full ten-day programme will receive a TrainingComplex Certificate of Completion in Advanced SQL Querying, which can be shared digitally with employers or added to a professional profile.

Is the course theoretical or practical?

The programme is heavily practical. Approximately 60% of each day is spent in hands-on lab sessions writing, testing, and optimising real SQL queries against business datasets. Conceptual explanations are concise and immediately followed by applied exercises.

Can my organisation arrange a private, customised delivery of this course?

Yes. TrainingComplex offers bespoke in-house delivery of this programme for teams of five or more, allowing the course content to be tailored to your organisation's specific database platform, datasets, and business use cases. Contact us directly to discuss a customised arrangement.

View Live Schedule & Book →