AquinasTraining.co.uk - training courses. Home  -  FAQ  -  Corporate Plans

SQL Server 2000/2005: Transact-SQL Querying

MSQ-TQ      Course duration (days): 4
Talk to a Training Advisor
Tel. 0800 652 0202
Availability (sort by: location | date)
Request availability by clicking a date.
Central London
City
London (NW1) 28/10/08 £ 1,695
London (NW1) 09/12/08 £ 1,695
London (NW1) 27/01/09 £ 1,695
London (NW1) 10/03/09 £ 1,695
Prices exc. VAT.  Courses are vendor approved.
Need help? Contact us now.

About this class

Microsoft's Transact-SQL is the cornerstone of all SQL Server database operations. Its SELECT statement appears simple, but in fact provides tremendous power for solving difficult business problems. To take advantage of this, developers need to know how to create advanced queries.

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.

Who will the lesson benefit?

This course is valuable for those who are developing systems using SQL Server databases, or who are using SQL to extract and analyse data from SQL Server databases. Course 530, " SQL Server 2000 Introduction ", or Course 131, " SQL Server 2005 Introduction ", or equivalent knowledge is assumed.

What delegates will learn

  • Develop complex and robust SQL queries for SQL Server 2005 and SQL Server 2000
  • Query multiple tables with inner joins, outer joins and self-joins
  • Transform data with built-in functions
  • Summarise data using aggregation and grouping
  • Execute analytic functions to calculate ranks
  • Build simple and correlated subqueries

Contents of this class

Introduction and Overview

SQL fundamentals

  • Retrieving data with SELECT
  • Expressions
  • Literals
  • Handling NULLs properly

Executing queries

  • Analysing query plans
  • Enhancing query performance
  • Testing queries
  • 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 UNION

  • Eliminating duplicate results
  • UNION ALL

Scalar and Aggregate Functions

Taking advantage of scalar functions

  • Converting datatypes
  • Handling dates
  • Manipulating strings
  • Choosing the right function for the job

Summarising data with aggregate functions

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

Grouping data

  • GROUP BY vs. GROUP BY ALL
  • Applying conditions with HAVING
  • Calculating moving averages
  • Nesting grouped aggregates
  • Joins and grouping
  • Introducing subtotals with CUBE and ROLLUP

Building crosstab reports

  • Using CASE to turn rows into columns
  • Applying PIVOT and UNPIVOT

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

Building Subqueries

Simple subqueries

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

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