Description
Description
Structured Query Language (SQL) is fundamental to all relational database operations. In this hands-on Advanced SQL course, you will learn to maximize the potential of the SELECT statement by writing robust queries using the most effective methods for your application. You’ll test your queries and learn to avoid common errors and pitfalls. The course also covers alternative solutions to various problems, allowing you to choose the most efficient solution for each situation.
Training Objectives
- 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.
Course Outline
- Module 1: Introduction and Overview<br />
- SQL fundamentals<
- Why SQL can be both easy and difficult<br />
- Recommendations for thorough testing<br />
- Retrieving data with SELECT<
- Expressions<br />
- Literals<br />
- Handling NULLs properly<br />
- Executing queries<
- Analysing query plans<br />
- Enhancing query performance<br />
- Retrieving partial results with FETCH and OFFSET<br />
- Selecting the best alternatives<br />
- Avoiding errors and pitfalls<
- Module 2: Querying Multiple Tables<br />
- Implementing various types of joins<
- Inner joins<br />
- Cross joins<br />
- Left, right, and full outer joins<br />
- Equijoins vs. theta joins<br />
- The performance implications of joins<br />
- Adding filter conditions to outer joins<br />
- Writing self joins<
- Joining a table to itself<br />
- Chaining self joins<br />
- Solving time-interval problems<br />
- Combining queries with set operators<
- UNION<br />
- UNION ALL<br />
- INTERSECT<br />
- EXCEPT<
- Module 3: Aggregate Functions<br />
- Summarising data with aggregate functions<
- COUNT<br />
- SUM<br />
- AVG<br />
- MIN<br />
- MAX<br />
- Managing NULLs<br />
- identifying duplicates<br />
- Grouping data<
- GROUP B<br />
- Applying conditions with HAVING<br />
- Calculating moving averages<br />
- Building crosstab reports<br />
- Extending group queries<
- Nesting grouped aggregates<br />
- Joins and grouping<br />
- Introducing subtotals with CUBE and ROLLUP<
- Module 4: Performing Extensive Analysis with Analytic Functions<br />
- The OVER clause<
- Specifying the ordering before applying the function<br />
- Splitting the result set into logical partitions<br />
- Calculating ranks<
- RANK and DENSE_RANK<br />
- ROW_NUMBER with ordered sets<br />
- Calculating percentiles<br />
- Extending the use of aggregates<
- Partitioning in multiple levels<br />
- Computing running totals<br />
- Comparing row and aggregate values<br />
- Top-N queries<br />
- Defining sliding window boundaries<
- Module 5: Building Subqueries<br />
- Self-contained subqueries<
- Subqueries in conditions and column expressions<br />
- Creating multilevel subqueries<br />
- Avoiding problems when subqueries return NULLs<br />
- Handling multirow subquery results<br />
- Finding gaps in number series<br />
- Correlated subqueries<
- Accessing values from the outer query<br />
- EXISTS vs. IN<br />
- Identifying duplicates<br />
- Avoiding accidental correlation<br />
- Common table expressions<
- Reusable subqueries<br />
- Recursive subqueries<br />
- Traversing hierarchies<
- Module 6: Breaking Down Complex Queries<br />
- Overcoming SQL limitations<br />
- Reducing complexity and improving performance




