Advanced SQL Querying Training Course

Duration 10 days 20 modules · 65 contact hours
Level Advanced Certificate on completion
Who attends Data Analysts, Business Intelligence Developers and others
Fee from USD 2,200 KSh 190,000 for Kenyan organisations
Where 52 cities + online See dates by city
Next start 16 Nov 2026 Course code SD-DS-055

Before you join: Participants should already be able to write routine SQL SELECT statements using WHERE, ORDER BY, GROUP BY, aggregate functions and basic INNER and LEFT joins.

Dates & prices

Two start dates a month in every city, and live online on weekdays or weekends. Fees are per participant; classroom fees include tuition, materials, lunch and refreshments, and the certificate.

Suggest a date or city

Showing the next six months. Later dates, other cities and private deliveries for your team are available on request.

Course overview

Complex SQL work often fails not because a query cannot return rows, but because results are duplicated by joins, business rules are embedded inconsistently, execution plans are ignored, or calculations cannot be audited. Analysts, engineers and database professionals need to turn operational questions into reliable query logic while protecting performance on large transactional and reporting databases. This course addresses the work required to produce defensible SQL for finance, customer, supply-chain, compliance and operational reporting.

Participants progress from advanced relational logic through multi-table joins, correlated subqueries, common table expressions, window functions, recursive queries, set operations and data-modification statements. They learn to inspect query execution plans, identify inefficient access paths, select suitable indexes, handle NULL values, and use transactions safely. The course also covers reusable query design, parameterisation, data-quality checks, temporal analysis and security-aware querying. Dialect differences are addressed where PostgreSQL, SQL Server, Oracle and MySQL use different syntax or optimizer behaviour.

Teaching combines concise technical briefings with instructor-led query construction, realistic datasets and peer review of query results. Cases use scenarios such as reconciliations in a bank, inventory exceptions in a manufacturer, customer-retention analysis in a telecoms provider and audit sampling for a public agency. Participants build a portfolio of annotated SQL scripts, execution-plan findings and a final analytical query pack. They leave with reusable patterns for producing correct, maintainable and efficient SQL under real reporting and operational constraints.

The course is suited to professionals who already write routine SELECT statements and now need to solve higher-value analytical, reporting and data-engineering problems. It is delivered over 10 instructor-led days in a classroom in 50+ cities or live online. Each training day runs from 08:30 to 16:30 and provides approximately 6.5 contact hours. Participants receive a certificate of completion.

What you will be able to do

  • Construct multi-table analytical queries using joins, CTEs, subqueries and set operators
  • Apply window functions to calculate rankings, running totals, cohorts and period comparisons
  • Diagnose slow SQL using execution plans, cardinality estimates and index access paths
  • Design recursive CTEs for hierarchies, bill-of-materials structures and graph-style relationships
  • Implement transaction-safe INSERT, UPDATE, DELETE and MERGE statements
  • Validate query outputs using reconciliation checks, anti-joins and exception queries
  • Write parameterised, maintainable SQL scripts with documented business rules
  • Present a reviewed analytical query pack addressing a realistic business requirement

Benefits of attending

For you

  • Produce auditable answers to complex operational and analytical questions
  • Reduce time spent manually reconciling extracts and spreadsheet calculations
  • Identify query defects before inaccurate figures reach decision-makers
  • Diagnose slow reports through evidence from execution plans
  • Build a reusable portfolio of advanced SQL patterns and annotated scripts

For your organisation

  • Improve reliability of management reports, regulatory extracts and operational dashboards
  • Reduce database load caused by inefficient joins, scans and repeated calculations
  • Standardise reusable SQL patterns for common reporting and control requirements
  • Strengthen data-quality checks before figures feed downstream systems
  • Shorten investigation cycles for customer, transaction and inventory exceptions

Course modules

20 modules over 10 days

Participants can define the correct row grain and translate complex business questions into relational query logic.

  • Row grain defined before joins, aggregations and calculated measures
  • Functional dependencies used to detect misleading grouping assumptions
  • Primary and foreign key relationships traced through operational schemas
  • Business questions translated into entity, event and measure requirements
  • Predicate placement compared between WHERE, ON and HAVING clauses
  • Three-valued logic examined for TRUE, FALSE and UNKNOWN outcomes

Participants can select join patterns that preserve intended row counts and prevent duplicate results.

  • INNER, LEFT, RIGHT and FULL joins compared by retained rows
  • Join cardinality assessed using one-to-one and one-to-many relationships
  • Duplicate multiplication diagnosed with pre-join row-count checks
  • Semi-joins implemented with EXISTS for membership testing
  • Anti-joins written to identify unmatched records and control exceptions
  • Self-joins applied to manager, successor and related-party relationships

Participants can create accurate grouped measures, conditional aggregations and reconciliation totals.

  • Conditional aggregation built with CASE expressions inside aggregate functions
  • GROUPING SETS produce departmental, regional and enterprise subtotals
  • ROLLUP and CUBE compared for hierarchical summary requirements
  • Distinct counts evaluated for accuracy, cost and business meaning
  • HAVING clauses filter aggregated groups without changing source records
  • Reconciliation totals compare detail, summary and source-system populations

Participants can use subqueries and CTEs to express staged business logic clearly.

  • Scalar subqueries return single values for row-level comparisons
  • Correlated subqueries evaluated against each outer query row
  • EXISTS and IN compared for NULL handling and optimizer choices
  • Common table expressions separate named stages of query logic
  • Multiple CTEs sequence filtering, enrichment and aggregation steps
  • Derived tables used when intermediate calculations require independent grouping

Participants can apply window functions to calculate measures without collapsing detail rows.

  • OVER clauses define partitions, ordering and window frames
  • ROW_NUMBER assigns deterministic sequence numbers within business groups
  • RANK and DENSE_RANK handle ties in performance comparisons
  • Running totals calculated using ordered cumulative window frames
  • LAG and LEAD compare transactions with prior or subsequent events
  • FIRST_VALUE and LAST_VALUE retrieve boundary values with explicit frames

Participants can analyse time-based activity, retention and period comparisons using SQL.

  • Calendar tables support complete periods and working-day analysis
  • Date truncation groups events into reporting weeks, months and quarters
  • Period-over-period comparisons calculated with LAG and date logic
  • Cohort assignment based on first purchase, registration or claim date
  • Retention rates derived from cohort activity across subsequent periods
  • Gaps-and-islands techniques identify consecutive activity and inactivity periods

Participants can handle missing values, conversions and exceptional data without distorting results.

  • NULL comparisons tested using IS NULL and IS NOT NULL
  • COALESCE and NULLIF control defaults and divide-by-zero conditions
  • CASE expressions encode explicit business classifications and exception states
  • CAST and CONVERT manage numeric, date and character transformations
  • Implicit conversions identified as sources of errors and poor performance
  • Rounding rules applied consistently to currency, rates and quantities

Participants can combine and compare result sets to identify differences and produce controlled outputs.

  • UNION and UNION ALL selected according to duplicate requirements
  • INTERSECT identifies records shared by independently generated populations
  • EXCEPT and MINUS reveal records missing from comparison datasets
  • Column compatibility checked before combining result sets
  • Reconciliation queries compare source extracts against reported outputs
  • Symmetric difference patterns expose mismatches between two record populations

Participants can build recursive queries for organisational, product and relationship hierarchies.

  • Recursive CTE anchor members establish hierarchy starting points
  • Recursive members join each level to its parent records
  • Hierarchy depth calculated for reporting lines and assembly structures
  • Path strings constructed to display complete ancestor relationships
  • Cycle detection prevents endless recursion in flawed relationship data
  • Bill-of-materials rollups calculate component requirements across multiple levels

Participants can identify common causes of slow SQL and formulate targeted improvements.

  • Execution plans read from operators, estimates, costs and row flows
  • Table scans distinguished from index seeks and index scans
  • Predicate sargability assessed for index-friendly search conditions
  • Cardinality estimate errors traced to skewed or stale statistics
  • Join algorithms compared: nested loops, hash joins and merge joins
  • Query rewrites tested while preserving required result-set semantics

Participants can recommend index and query changes based on observed access patterns.

  • Composite index key order matched to filtering and joining predicates
  • Covering indexes evaluated using included columns and lookup avoidance
  • Selective predicates prioritised when designing useful access paths
  • Functions on indexed columns examined for lost index access
  • Index maintenance trade-offs considered for write-heavy transactional tables
  • Plan comparisons document performance effects before production deployment

Participants can write controlled data-change statements that preserve integrity and auditability.

  • INSERT statements load validated rows from staged query results
  • UPDATE statements target intended records using explicit qualification criteria
  • DELETE operations preceded by count checks and transaction safeguards
  • MERGE patterns synchronise source and target records under defined rules
  • OUTPUT and RETURNING clauses capture changed rows for audit trails
  • Upsert risks assessed for concurrency, duplicates and unexpected matches

Participants can apply transaction controls and recognise concurrency risks in SQL operations.

  • ACID properties connected to reliable multi-step database operations
  • BEGIN, COMMIT and ROLLBACK control units of work
  • Isolation levels compared for visibility, locking and consistency effects
  • Dirty reads, non-repeatable reads and phantom reads distinguished
  • Deadlock conditions identified from competing lock acquisition patterns
  • Savepoints support controlled recovery within longer data-change transactions

Participants can build SQL checks that identify incomplete, invalid and inconsistent data.

  • Completeness checks identify mandatory attributes missing from critical records
  • Referential integrity exceptions found through anti-join validation queries
  • Domain checks test permitted codes, ranges and date relationships
  • Duplicate detection combines partitioning with business-key definitions
  • Outlier queries flag unusual values using statistical and rule-based thresholds
  • Control totals document record counts, amounts and exception populations

Participants can structure reusable SQL scripts that support controlled reporting requirements.

  • Named parameters isolate report dates, entities and threshold values
  • Views encapsulate stable logic for approved reporting datasets
  • Temporary tables compared with CTEs for staged processing needs
  • Stored procedure design separates inputs, processing and returned results
  • SQL comments document assumptions, source tables and business definitions
  • Formatting conventions improve review, maintenance and change control

Participants can account for access controls and sensitive data when constructing queries.

  • Least-privilege access applied to tables, views and stored procedures
  • Row-level security effects checked against expected report populations
  • Column masking implications assessed for identifiers and sensitive attributes
  • Parameterized queries reduce SQL injection exposure in application code
  • Sensitive extracts minimised through purpose-specific field selection
  • Audit requirements documented for data changes and privileged queries

Participants can identify vendor-specific SQL differences and write portable query logic where appropriate.

  • ANSI/ISO SQL constructs separated from vendor-specific extensions
  • Date arithmetic differences compared across PostgreSQL, SQL Server and Oracle
  • Pagination syntax reviewed using LIMIT, FETCH and OFFSET patterns
  • Identifier quoting rules checked before cross-platform script migration
  • String concatenation and NULL behaviour tested across database dialects
  • Execution-plan tooling compared for vendor-specific diagnostic workflows

Participants can organise a complex analytical request into testable, efficient SQL stages.

  • Requirements decomposed into population, measures, rules and presentation outputs
  • Source-table profiling establishes grain, completeness and relationship assumptions
  • Staged CTE architecture separates extraction, enrichment and calculation logic
  • Validation queries test each stage against agreed control totals
  • Performance checkpoints assess high-cost joins and aggregations early
  • Query documentation records assumptions, limitations and approval decisions

Participants can review SQL for correctness, performance, security and maintainability before release.

  • Code review checklists assess joins, filters, aggregations and NULL handling
  • Expected row counts defined for each critical query stage
  • Boundary conditions tested for dates, thresholds and empty populations
  • Execution plans reviewed after representative parameter values are applied
  • Rollback plans prepared for production data-change statements
  • Release notes capture dependencies, permissions and operational ownership

Participants can build, review and present a complete analytical query pack for a realistic business requirement.

  • Business requirement translated into documented data and calculation specifications
  • Source population defined with defensible filters and relationship assumptions
  • Multi-stage SQL developed using CTEs, joins and window functions
  • Data-quality controls quantify exclusions, duplicates and reconciliation differences
  • Execution plan findings support targeted performance improvements and index recommendations
  • Peer review evaluates correctness, maintainability, security and reporting usefulness

Exercises and examples are adapted to each cohort's sectors and roles.

What you take back to work

  1. Advanced SQL query pattern library
  2. Execution plan diagnostic checklist
  3. Data-quality validation query pack
  4. SQL code review checklist
  5. Parameterised reporting script template
  6. Annotated capstone analytical query pack

Who should attend

  • Data Analysts — need reliable SQL for complex reporting and investigation
  • Business Intelligence Developers — build reusable datasets and reporting logic
  • Data Engineers — prepare efficient transformations and validation queries
  • Database Developers — improve query design and diagnose performance issues
  • Financial Systems Analysts — reconcile transactions and investigate control exceptions
  • Application Developers — write safer, faster database access queries

Skills and tools covered

Advanced query designWindow function analysisQuery performance tuningExecution plan interpretationData quality validationTransaction-safe SQL

Tools and standards

ANSI/ISO SQL, PostgreSQL EXPLAIN, SQL Server Actual Execution Plan, Oracle EXPLAIN PLAN

How the course runs

Training methodology

The instructor introduces each SQL technique through short technical briefings and worked query examples. Participants then analyse realistic schemas and datasets, construct queries individually and in small groups, and compare alternative solutions for correctness and performance. Facilitated reviews focus on join grain, NULL behaviour, calculation logic, execution plans and maintainability. Cases include reporting, reconciliation, exception detection and hierarchy analysis. The final sessions use structured application planning and peer review to prepare participants for the capstone query pack.

Requirements and prerequisites

Participants should already be able to write routine SQL SELECT statements using WHERE, ORDER BY, GROUP BY, aggregate functions and basic INNER and LEFT joins. Experience querying a relational database for reports, analysis or application support is expected. Familiarity with tables, primary keys, foreign keys and basic data types is assumed. Participants should be comfortable reading query results and identifying unexpected records. Prior database administration, programming, data-modelling or performance-tuning experience is not required. The course does not require prior knowledge of a specific vendor database, although participants benefit from knowing their workplace SQL platform.

A typical training day

08:30 – 10:30First session
10:30 – 10:45Refreshment break
10:45 – 12:30Second session
12:30 – 13:30Lunch and networking
13:30 – 15:00Third session
15:00 – 15:15Refreshment break
15:15 – 16:30Workshop and daily review

Live online deliveries follow the same structure in East Africa Time, with shorter screen blocks and longer breaks.

What the fee includes

  • Instruction by a practitioner facilitator
  • Full course workbook and materials
  • Exercise files, templates and case studies
  • Refreshments and lunch on classroom deliveries
  • Certificate of completion
  • Post-course application plan

Frequently asked questions

You should be comfortable writing SELECT statements, filters, aggregations and basic joins. The course begins with advanced relational logic rather than introductory SQL syntax, so it is not suitable for complete beginners.

Bring a laptop if attending in person, along with details of the database platform and reporting challenges you use at work. Course datasets and SQL materials are provided; access to your employer's systems is neither required nor expected.

It is designed for analysts, BI developers, data engineers, database developers and systems professionals who already query relational data. It is also relevant to finance, risk and operations specialists who need stronger control over reporting logic.

Introductory SQL focuses on basic retrieval, filtering and grouping, while this course concentrates on complex query design, analytical functions, performance and validation. It is not a database administration course: server installation, backup administration and infrastructure management are outside scope.

Participants can use the query patterns for reconciliations, exception reporting, period comparisons, hierarchy analysis and report-performance investigations. The code review, validation and execution-plan materials can also be adapted for team standards.

The first week establishes advanced query construction, analytical patterns and data-quality controls while participants begin building reusable SQL. The second week focuses on performance, transactions, reusable reporting design, review methods and the final capstone query pack.

Questions about this course?

Ask about dates, fees, group bookings or running it for your team. Our training team replies by email.