Advanced Querying Techniques in SQL Server
https://www.pluralsight.com/courses/advanced-querying-techniques-sql-server
by Gerald Britton
Mod 1: Course Overview
- Course Overview
Mod 2: Navigating Data Hierarchies Using Recursive Queries
- Introduction to Recursive Queries
- Using the WITH Statement
- Demo: Iterative Queries Using the WITH Statement
- Writing Recursive Transact-SQL
- Demo: Simple Recursive Queries
- you can use the MAXRECURSION clause to safeguard against an infinite loop cause by a recursive query
- how to generate Fibonacci series using recursive t-sql
- T-SQL Restrictions for Recursive Queries
- Cannot be used with recursive queries
- SELECT DISTINCT
- GROUP BY, HAVING
- Scalar aggregation (SUM, AVG, MIN, MAX etc.)
- PIVOT (SQL Server 2012 or later)
- TOP
- LEFT, RIGHT, OUTER JOIN (INNER JOIN is allowed)
- Subqueries
- Demo: Navigating a Data Hierarchy Using Recursion in T-SQL
- Module Summary
- SQL Server maximum recursion (32,767)
Mod 3: Aggregating Data Using the PIVOT and UNPIVOT Clauses
- Introduction to PIVOT and UNPIVOT
- Demo: Pivoting in a Spreadsheet
- Demo: Pivoting in Transact-SQL Using Cross-tabulation
- Understanding PIVOT Syntax
- Demo: Using PIVOT in Transact-SQL
- Demo: Pivoting on Multiple Columns
- Demo: Building a Dynamic PIVOT Query
- Understanding UNPIVOT Syntax
- Demo: Using UNPIVOT and CROSS APPLY
- Module Summary
Mod 4: Storing Data as Entities, Attributes, and Values (EAV)
- Introduction to the EAV Model
- Demo: Handling Sparse Data Using a Traditional Approach
- sql server allows 1024 columns per table
- Demo: Refactoring into an EAV Model
- demo of an unstructured sql table, an EAV. you can basically have a schema-less design in sql server, with unlimited columns. however, you sacrifice referential integrity and writing queries become very difficult stackoverflow
- Demo: Factoring out Attributes Using Foreign Keys
- Recapping Progress and Issues
- Demo: Handling Types and Constraints
- Demo: Implementing Dynamic Constraints
- Demo: Exploring Sparse Columns
- you can mark a column SPARSE
- occupies no space when value is null or 0
- Demo: Using XML as an Alternative
- demo of the XML data type in sql server
- Demo: From XML to JSON
- sql server 2016 introduced JSON support (not as a data type)
- you can use JSON_VALUE to query a value
- Module Summary
Mod 5: Sampling Data in SQL Server
- Introducing Data Sampling
- Understanding Data Sampling Terminology
- The Syntax of the TABLESAMPLE Option
- Demo: Using the TABLESAMPLE Option
- Demo: Stratified Sampling
- Demo: Cluster Sampling
- Module Summary
Comments
Post a Comment