DBI309: Using SQL Server 2012 Window Functions to Solve Common T-SQL Challenges Steven Wang MCITP – BI, Database Developer and DBA.

Slides:



Advertisements
Similar presentations
Upgrading SSIS Packages to SQL Server 2012 Sven Aelterman Lecturer in Information Systems & Web/Technology Specialist Troy University, Sorrell College.
Advertisements

What's New in Microsoft Deployment Toolkit 2012 Michael Niehaus Senior Program Manager Microsoft Corporation.
Deploying Windows 8 with MDT: A Preview Michael Niehaus Senior Program Manager Microsoft Corporation.
Troubleshooting Windows 7 Deployments Michael Niehaus Senior Program Manager Microsoft Corporation.
DBI331. Cube Measure Group Measure Partition Cube Dimension Dimension Attribute Relationship Hierarchy Level Cube Attribute Cube Hierarchy Measure.
Data Mining 2012 with Microsoft Excel 2010 and PowerPivot Mark Tabladillo, Ph.D. Microsoft MVP, Data Mining Architect MarkTab Consulting DBI204.
Enterprise Information Management (EIM): Bringing Together SSIS, DQS, and MDS Matt Masson Senior Program Manager Microsoft Corporation Matthew Roche Senior.
DEV314. Entity Data Model demo Entity Data Model.
DBI311. Existing NMS application Agent Existing NMS application Agent 0.5 KB/record 2500 records/ agent 10 agents = 25K r/s (12. 5 MB/s) 25K r/s.
Delivering KPIs with Microsoft SQL Server Analysis Services
4/19/2017 7:47 PM DBI311 Microsoft SQL Server Data Tools: Database Development from Zero to Sixty Gert Drapers Principal Group Program Manager.
Configuring Kerberos for Microsoft SharePoint 2010 BI in 7 Steps (SQL Server 2012) Chuck Heinzelman Senior Program Manager – BPD CX Microsoft Corporation.
Implementing Scrum Using Team Foundation Server Richard Hundhausen President, Accentient DEV212.
Optimizing Microsoft SQL Server Analysis Services for Big Data Adam Jorgensen Microsoft Corporation.
demo.
Exploring SQL Server Data Tier Applications Bob Beauchemin Developer Skills Partner SQLskills DBI309.
Julie Strauss Senior Program Manager Lead Microsoft Corporation
ADVANCE T-SQL: WINDOW FUNCTIONS Rahman Wehelie 7/16/2013 ITC 226.
DBI326. PhraseGoal “Data Mining”Inform actionable decisions “Machine Learning”Determine best performing algorithm.
ASP.NET for Mobile and Tablet Development Damian Edwards Senior Program Manager Microsoft Corporation.
2.
Visual C#/Visual Basic: Becoming a Guru with Existing Features Peter Ritchie Principle Peter Ritchie Inc. Software Consulting DEV325.
DEV211. The simplest way to create business applications for the desktop and the cloud.
Building Self-Service BI Applications Using PowerPivot Julie Strauss Senior Program Manager Lead Microsoft Corporation DBI301.
More Windowing Functions KEVIN MCCARTY. What are Windowing Functions Again? Introduced in SQL Server 2005 (SQL 2003 Standard) Used to provide operations.
DBI325. Monitoring Analytics Support will extend to Analysis Services in the Denali release.
DEV332. Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification Exam that.
OSP201: Creating Self- Service BI Solutions with SharePoint Server 2010 Peter Myers.
Learn more: Download SCM: Join the TechNet Wiki community:
DEV348. demo Valid HTML5 Syntax demo.
Cloud-Ready Data Services. cloud data services.
Sofia, Bulgaria | 9-10 October SQL Querying Tips & Techniques Richard Campbell.
Patrick Ortiz Global SQL Solution Architect Dell Inc. BIN209.
Asif Rehmani Trainer SharePoint-eLearning.com OFC 301.
Windows 7, Configuring. Exam Cram : Configuring Windows 7 Bob Reinsch Senior Technical Instructor Centriq Training, Kansas City (USA)
demo Value Profit per country $542, $56, $175, $182, $223, $324, Profit for current country Rank.
DEV353. Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification.
Data Analysis with SQL Window Functions Adam McDonald IT Architect / Senior SQL Developer Smith Travel
Julie Strauss Senior Program Manager Lead Microsoft Corporation
Running Reporting Services in SharePoint Integrated Mode: How and Why
6/19/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Matt Masson Senior Program Manager Microsoft Corporation
Data Analysis with SQL Window Functions
Using Window Ranking, Offset, and Aggregate Functions
Microsoft Visual Studio IDE Futures
9/22/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Enriching your BI Semantic Models with Data Analysis Expressions (DAX)
Building the Perfect BI Semantic Model for Power View
T-SQL Power! The OVER Clause: Your Key to No-Sweat Problem Solving
T-SQL Window Function Deep Dive part 1
Writing Better Queries with Window Functions
TechEd /23/ :44 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
TechEd /24/2018 6:19 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Visual Studio 2013 for web developers
Kasper de Jonge Microsoft Corporation
Introduction to Window Functions
TechEd /11/ :54 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
DEV410: Deep Dive into Team Foundation Server 2012 Reporting
Data Analysis with SQL Window Functions
Introduction to T-sql Window functionS
TechEd /18/2019 2:43 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
2/17/2019 7:32 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
2010 Microsoft BI Conference
Pushing Data to and from the Cloud with SQL Azure Data Sync
Fewer cursors since SQL Server 2012 Came Along
Enriching your BI Semantic Models with Data Analysis Expressions (DAX)
Code First Development in Microsoft ADO.NET Entity Framework 4.1
Running Reporting Services in SharePoint Integrated Mode: How and Why
Cloud-powered Load Testing with Team Foundation Service
Exploring the latest T-SQL enhancements
Presentation transcript:

DBI309: Using SQL Server 2012 Window Functions to Solve Common T-SQL Challenges Steven Wang MCITP – BI, Database Developer and DBA

Senior DBA Write MSBICOE.com Active Participant One of Top Answers Steven Wang

Agenda 2. ********** (Encrypted) 1. Solution Comparison 3.The Nitty- Gritties 5. Performance Comparison Demo

Note: The table is simplified for demo Purpose.

Note: The table is simplified for demo Purpose. A. 2000B. 2005C D E. Wrong Syntax

A. 2000B. 2005C D E. Wrong Syntax

A. 2000B. 2005C D E. Wrong Syntax

A. B.

--Quoted from PostgreSQL Documentation --SQL Server 2012, BOL

SQL: 2008 SQL: 2003 SQL: 2011 SQL: 2006 ISO/ANSI Standard Window Functions introduced No Changes on Window Functions Window Functions Enhanced Extensive Coverage on Window Functions Over Clause (Limited) Rank Functions SQL Server 2005 No new Features for Window Functions SQL Server 2008 Extended support on Over Clause Distribution Functions Offset Functions SQL Server 2012 SQL Server VNext

Over()Over( ) Sum(Amount) Over( ) Partition By EmployeeID Order By Period Desc Rows Between Unbounded Preceding And 2 Following

Sum(Amount) Over( ) Partition By EmployeeID Order By Period Rows Between Unbounded Preceding And 2 Following Partition By Order by Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6

FromWhereGroup ByHavingSelectOrder By fwgh SO

Agg([All] Expression) Over(…) Agg(Exp) Over(…) Agg(All Exp) Over(…) Agg(Distinct Exp) Over(…) No Distinct Aggregations with Over() Note: Agg refers to all aggregation functions

fwgh SO No Distinct in aggregation with Over() A few more

A. 1 B C. Both valid D. Both not

demo The T-SQL Challenge Solutions

Subquery Window Function

demo Performance Comparisons

Running Total Benchmark

SELECT Reverse( Concat(Col, Lead(Col,1) Over(Order by Col Desc) ) ) As Conclusion FROM ( Values ('!!lacirogamsatnahp'), (' era snoitcnuF wodniW') ) T(Col) ORDER BY Col Desc OFFSET 0 ROW FETCH FIRST 1 ROW ONLY;

DBI305: Practical Uses and Optimisation of New T-SQL Features in Microsoft SQL Server Dave Dustin Exam : Querying Microsoft SQL Server 2012 Contact Me Later at LinkedIn Search: Steven Wang Blog: Required Slide *delete this box when your slide is finalised Speakers, please list the Breakout Sessions and Certification Exams that relate to your session. Make sure to indicate how delegates may contact you, if they have questions after the session.

Win instant prizes by evaluating this session: aka.ms/mobile

Connect. Share. Discuss. newzealand.msteched.com Learning Microsoft Certification & Training Resources microsoft.com/learning TechNet Resources for IT Professionals microsoft.co.nz/technet Resources for Developers microsoft.co.nz/msdn