0345 4506120

Writing Advanced SQL Queries

Course Details

Name Writing Advanced SQL Queries
Description
URL
Location:
London - Central
Start Date:
Working Days:
Price:
£1298.00 +vat
was £1498.00
Availability:
Exam:
Residential:
Course ID:
438017
Offer

Overview

SQL is the cornerstone of all relational database operations. In this hands-on course, you learn to exploit the full potential of the SELECT statement to write robust queries using the best query method for your application, test your queries, and avoid common errors and pitfalls. It also teaches alternative solutions to given problems, enabling you to choose the most efficient solution in each situation. 

The SQL Language is an ANSI/ISO standard language used by all relational database products. This course describes the standard language, but also identifies deviations from the standard in two widely-used database products, Oracle and Microsoft SQL Server. For the hands-on exercises, the course environment allows the students to choose between working with the PostgreSQL database product or Microsoft SQL Server.

Learning Objectives

You Will Learn How To:

  • Maximise the potential of SQL to build powerful, complex and robust SQL queries
  • Query multiple tables with inner joins, outer joins and self joins
  • Construct recursive common table expressions
  • Summarise data using aggregation and grouping
  • Execute analytic functions to calculate ranks
  • Build simple and correlated subqueries
  • Thoroughly test SQL queries to avoid common errors
  • Select the most efficient solution to complex SQL problems

Who Should Attend:

  • Those who are developing applications using relational databases, or who are using SQL to extract and analyse data from databases and need to use the full power of SQL queries.

Pre-Requisites

Recommended Experience:

  • This is an advanced course and knowledge of the basics of SQL at the level of Introduction to SQL Programming Training or equivalent is assumed.

Course Content

Course Outline

Introduction and Overview

SQL fundamentals

  • Why SQL can be both easy and difficult 
  • Recommendations for thorough testing

Retrieving data with SELECT

  • Expressions
  • Literals
  • Handling NULLs properly

Executing queries

  • Analysing query plans 
  • Enhancing query performance 
  • Retrieving partly results with FETCH and OFFSET
  • Selecting the best alternatives 
  • Avoiding errors and pitfalls

Querying Multiple Tables

Implementing various types of joins

  • Inner joins 
  • Cross joins 
  • Left, right and full outer joins 
  • Equijoins vs. theta joins 
  • The performance implications of joins 
  • Adding filter conditions to outer joins

Writing self joins

  • Joining a table to itself 
  • Chaining self joins 
  • Solving time-interval problems

Combining queries with set operators

  • UNION 
  • UNION ALL 
  • INTERSECT 
  • EXCEPT

Aggregate Functions

Summarising data with aggregate functions

  • COUNT 
  • SUM 
  • AVG 
  • MIN 
  • MAX 
  • Managing NULLs 
  • identifying duplicates

Grouping data

  • GROUP B
  • Applying conditions with HAVING 
  • Calculating moving averages
  • Building crosstab reports

Extending group queries

  • Nesting grouped aggregates 
  • Joins and grouping 
  • Introducing subtotals with CUBE and ROLLUP

Performing Extensive Analysis with Analytic Functions

The OVER clause

  • Specifying the ordering before applying the function
  • Splitting the result set into logical partitions

Calculating ranks

  • RANK and DENSE_RANK 
  • ROW_NUMBER with ordered sets 
  • Calculating percentiles

Extending the use of aggregates

  • Partitioning in multiple levels 
  • Computing running totals 
  • Comparing row and aggregate values
  • Top-N queries
  • Defining sliding window boundaries

Building Subqueries

Self-contained subqueries

  • Subqueries in conditions and column expressions 
  • Creating multilevel subqueries 
  • Avoiding problems when subqueries return NULLs 
  • Handling multirow subquery results
  • Finding gaps in number series

Correlated subqueries

  • Accessing values from the outer query 
  • EXISTS vs. IN 
  • Identifying duplicates 
  • Avoiding accidental correlation

Common table expressions

  • Reusable subqueries 
  • Recursive subqueries 
  • Traversing hierarchies

Breaking Down Complex Queries

  • Overcoming SQL limitations 
  • Reducing complexity and improving performance

London - Euston

Description:

This venue, based in Central London, has over 30 fully-equipped classrooms. The classrooms are spread across four floors of Euston House and there are coffee lounges on each floor. 

Registration takes place in the Reception Area on the ground floor and the nearest tube stations are Euston and Euston Square.

Location:

Euston House
24 Eversholt Street
London
NW1 1AD

 

Directions:

From Euston Station
(Northern and Victoria Lines)

Exit into Euston Railway Station. Leave the station through the main doors and turn left immediately. Walk along to stairs leading down to Eversholt Street. Cross the road to Euston House.

For the latest travel information, please visit www.tfl.gov.uk

From Euston Square Underground Station

(Circle, Metropolitan, Hammersmith and City Lines)

Take the exit marked Euston Road (North) and Railway Station. Turn left at the top of the stairs onto Euston Road. Walk past two sets of traffic lights and Euston Railway Station. On the third set of traffic lights turn left into Euston Square. This becomes Eversholt Street. Euston House is on the right past The Royal George Pub.

Parking


All London car parks charge typical city rates.  The closest is the NCP car park at Euston Railway Station.


Our Customers Include