T-SQL: Simple Changes That Go a Long Way

Slides:



Advertisements
Similar presentations
1 Constraints, Triggers and Active Databases Chapter 9.
Advertisements

Concepts of Database Management Seventh Edition
SQL Basics. SQL SQL (Structured Query Language) is a special-purpose programming language designed from managing data in relational database management.
Version 1.0. MCAD MCSD MCPD Enterprise SQL MCTS MCT Software/Web Development Consultant Cryptography/Digital Signature Consultant SQL Server 2005/2008R2/2012.
ADVANCE T-SQL: WINDOW FUNCTIONS Rahman Wehelie 7/16/2013 ITC 226.
 Continue queries ◦ You completed two tutorials with step-by-step instructions for creating queries in MS Access. ◦ Now must apply knowledge and skills.
By: Matt Batalon, MCITP  Another form of temporary storage that can be queried or joined against, much like a table variable, temp.
Using Special Operators (LIKE and IN)
 Agenda 2/20/13 o Review quiz, answer questions o Review database design exercises from 2/13 o Create relationships through “Lookup tables” o Discuss.
Mark Inman U.S. Navy (Naval Sea Logistics Center) Session #213 Analytic SQL for Beginners.
T-SQL: Simple Changes That Go a Long Way DAVE ingeniousSQL.com linkedin.com/in/ingenioussql.
More Windowing Functions KEVIN MCCARTY. What are Windowing Functions Again? Introduced in SQL Server 2005 (SQL 2003 Standard) Used to provide operations.
In this session, you will learn to: Use functions to customize the result set Summarize and group data Objectives.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
IS201 Agenda: 09/19  Modify contents of the database.  Discuss queries: Turning data stored in a database into information for decision making.  Create.
Access Queries Agenda 6/16/14 Review Access Project Part 1, answer questions Discuss queries: Turning data stored in a database into information for decision.
05 | SET Operators, Windows Functions, and Grouping Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program.
Random Query Generator for Hive November 2015 Hive Contributor Meetup Szehon Ho.
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Background Lots of Demos(That’s it.)
Sofia, Bulgaria | 9-10 October SQL Querying Tips & Techniques Richard Campbell.
 Review quiz. Answer questions.  Discuss queries: ◦ What is a query? Turning data stored in a database into information for decision making. ◦ You: Completed.
A Glance at the Window Functions. Window Functions Introduced in SQL 2005 Enhanced in SQL 2012 So-called because they operate on a defined portion of.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Self-Service Business Intelligence with Power BI Theresa Eller | sharepointmadam.com | slideshare.net/SharePointMadam.
Scripting Just Enough SSIS to be Dangerous. 6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation.
6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration.
Eugene Meidinger Intermediate Querying: Going Beyond Select
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Advanced SQL.
T-SQL Power! Windows That Open Doors Adam
Data Analysis with SQL Window Functions Adam McDonald IT Architect / Senior SQL Developer Smith Travel
Using Common Table Expressions
Structured Query Language
Visual Studio Database Tools (aka SQL Server Data Tools)
Temporal Databases Microsoft SQL Server 2016
An Refresher and How-To Profile Data using SQL
Relational Database Design
Introduction to SQL 2016 Temporal Tables
© 2016, Mike Murach & Associates, Inc.
T-SQL: Simple Changes That Go a Long Way
Data Analysis with SQL Window Functions
Using Window Ranking, Offset, and Aggregate Functions
The Ins and Outs of Partitioned Tables
Optimizing Microsoft SQL Server 2008 Applications Using Table Valued Parameters, XML, and MERGE
Using Indexed Views & Computed Columns for Performance !
Traveling in time with SQL Server 2017
Cardinality Estimator 2014/2016
WINDOW FUNCTIONS ARE YOUR FRIENDS Dejan
WINDOW FUNCTIONS ARE YOUR FRIENDS Dejan
Statistics What are the chances
Writing Better Queries with Window Functions
Using Common Table Expressions
Visual Studio Database Tools (aka SQL Server Data Tools)
Transact SQL Performance Tips
Introduction to Window Functions
T-SQL gotchas and power-ups
Data Analysis with SQL Window Functions
Introduction to T-sql Window functionS
SQL Aggregation.
Contents Preface I Introduction Lesson Objectives I-2
Score a (row) goal and beat a query optimizer
SQL Server Query Design and Optimization Recommendations
Build on-the-fly reporting with Dynamic SQL
Triggers 7/11/2019 See scm-intranet.
Introduction to SQL Server and the Structure Query Language
Intermediate Query Structure and Development
T-SQL: Simple Changes That Go a Long Way
Just Enough SSIS Scripting to be Dangerous.
Presentation transcript:

T-SQL: Simple Changes That Go a Long Way DAVE VALENTINE @ingeniousSQL ingeniousSQL.com linkedin.com/in/ingenioussql

Thank You Sponsors! Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration area to be entered in additional drawings. Want more free training? Check out the Houston Area SQL Server User Group which meets on the 2nd Tuesday of each month. Details at http://houston.sqlpass.org

Agenda OUTPUT INTO Table Valued Parameter Window Functions Common Table Expressions COALESCE & ISNULL

Understand the Problem Before You Fix Create the Problem

About Dave… MCP MCSA: SQL Server 2012 Database / BI Developer Adjunct Professor @IngeniousSQL Dave.Valentine@IngeniousSQL.com IngeniousSQL.com

OUTPUT INSERT, UPDATE, DELETE, MERGE @@IDENTITY SCOPE_IDENTITY IDENT_CURRENT INSERTED.* and DELETED.* http://technet.microsoft.com/en-us/library/ms177564.aspx

INTO INTO <New Table> Debugging Table Definitions TVP and Table Variables Indexes, Triggers and Constraints Identities https://technet.microsoft.com/en-us/library/ms188029.aspx

Table Valued Parameter Easily store and transfer rows of data User Defined Table Type UNIQUE and PRIMARY KEY Constraints No indexing No statistics Read only as procedure parameters http://technet.microsoft.com/en-us/library/bb510489.aspx

T-SQL Window Functions Ranking RANK, ROW_NUMBER, NTILE, DENSE_RANK http://technet.microsoft.com/en-us/library/ms189798.aspx Aggregate AVG, MIN, SUM, COUNT, STDEV, VAR, MAX http://technet.microsoft.com/en-us/library/ms173454.aspx Analytic LEAD, FIRST_VALUE, LAG, LAST_VALUE http://technet.microsoft.com/en-us/library/hh213234.aspx

Common Table Expressions CTE Simplify query syntax Multiple reference Recursive queries VIEW alternative http://technet.microsoft.com/en-us/library/ms190766(v=sql.105).aspx

COALESCE & ISNULL COALESCE (expression [,…n]) ISNULL (expression, expression) Data Types Optional Parameter CSV https://technet.microsoft.com/en-us/library/ms190349.aspx https://technet.microsoft.com/en-us/library/aa933210.aspx

T-SQL Simple Changes Demo

Summary INTO OUTPUT Table Valued Parameter Window Functions Common Table Expressions COALESCE & ISNULL

Questions DAVE VALENTINE @ingeniousSQL ingeniousSQL.com linkedin.com/in/ingenioussql