SQL 2014 Developer, Part 11 of 13: Complex Querying
Interactive

SQL 2014 Developer, Part 11 of 13: Complex Querying

Biz Library
Updated Feb 04, 2020

We’ll start off by discussing the specifics of a topic you might not expect—handling NULLs! I know it sounds surprising, but it’s important to really understand how to work with NULL values—especially if you plan to integrate with the Common Language Runtime. Next, we’ll address another common and seemingly straightforward task—the ranking of data. We’ll explore the specifics of how to rank grouped data using some T-SQL functions including ROW_NUMBER, RANK, DENSE_RANK, and NTILE. Next we’ll take a look at how to identify correlated subqueries and how you can possibly replace them with more efficient constructs. Finally, we’ll look at an alternative to subqueries, derived tables, and temporary tables—known as Common Table Expressions, or CTEs, they are similar to derived tables but they are self-referencing, can be used numerous times within the same query, and can be called recursively!


Lesson 1:

  • Working with NULL Values
  • SqlTypes and CLR Types
  • Demo: NULLs
  • ANSI_NULLS
  • Demo: ANSI_NULLS
  • NULLs and SqlBoolean
  • Assigning NULL Values
  • CLR Integration
  • Direct Assignment
  • NULLIF
  • COALESCE
  • Demo: NULL Functions
  • Demo: NULL Value Assignment.

Lesson 2:

  • Ranking Grouped Data
  • The ROW_NUMBER Function
  • The RANK Function
  • DENSE_RANK Function
  • The NTILE Function
  • Demo: ROW_NUMBER
  • Demo: RANK
  • Demo: DENSE_RANK
  • Demo: NTILE.

Lesson 3:

  • Writing Correlated Subqueries
  • Subquery Basics
  • What is a Correlated Subquery?
  • Demo: Subqueries
  • Using the WHERE Clause
  • ANY, SOME, and ALL Modifiers
  • Including the HAVING Clause
  • Subqueries and Updates
  • Demo: ALL Modifier
  • Demo: HAVING Clause
  • Joins and Temp Tables
  • Demo: Replacing a Subquery.

Lesson 4:

  • Using Common Table Expressions
  • CTE Syntax
  • Demo: Common Table Expression
  • Recursive CTEs
  • Demo: Recursive CTEs
  • Demo: Executing a Recursive CTE.