Download presentation
Presentation is loading. Please wait.
Published byMariah Cox Modified over 8 years ago
1
Eugene Meidinger Intermediate Querying: Going Beyond Select * @sqlgene www.sqlgene.com emeidinger@all-lines-tech.com
2
About me Worked for All-Lines / Lantek for 4 years Business Intelligence team lead Went from SQL newb to SQL pro Certified in querying and administering SQL Server Spoken at Pittsburgh SQL User Group and SQL Saturdays
3
What is this talk about? Where do you go once you know the basics? Will be doing demos Feel free to interrupt Based on SQL Server 2012 Some functions are new
4
What we will cover Subqueries Window Functions Ranking functions Aggregate functions Analytic functions MERGE statement
5
What is a subquery? A query inside of a query
6
Where can you use subqueries? Column value From Clause Where Clause IN statement EXISTS statement Having Clause
7
Demo Slide - Subqueries
8
What is a windowing function? Applies a function OVER a WINDOW of rows Windows are grouped by PARTITIONs Some functions depend on an ORDERing
9
Ranking functions Row number Rank Dense Rank Ntile
10
Aggregate functions SUM, COUNT, MAX, etc Uses OVER for partitioning
11
Analytic functions First_value Last_value Lead Lag …and more
12
Demo Slide – Window Functions
13
What is the MERGE statement? Powerful tool for basic ETL Used to reconcile two data sources Great for UPSERTS
14
What are the parts of a merge statement? MERGE USING WHEN MATCHED WHEN NOT MATCHED BY TARGET WHEN NOT MATCHED BY SOURCE OUTPUT
15
Demo Slide – MERGE statement
16
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.