Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.

Slides:



Advertisements
Similar presentations
Virtual training week 4 structured query language (SQL)
Advertisements

Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Introduction to Structured Query Language (SQL)
Introduction to Structured Query Language (SQL)
Introduction to Structured Query Language (SQL)
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Meet Jeremy Thake Jeremy recently joined Microsoft as Technical Product Manager for the Visual Studio Developer story for Office 365 development.
Concepts of Database Management Sixth Edition
Dual Partitioning for improved performance in VLDBs Ashwin Rao Karavadi, Rakesh Parida Microsoft IT.
Database Fundamentals
02 | Advanced SELECT Statements Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.
Nick Scott | Dynamics CRM Consultant with BKD Technologies.
SQL Server Developer Tools, Codename “Juneau” Database Services Sanjay Nagamangalam Principal Program Manager SQL Server Manageability.
Session 1.
Bill Baer is a Senior Product Marketing Manager and Microsoft Certified Master for SharePoint in the SharePoint product group in Redmond, Washington;
Version 1.0. MCAD MCSD MCPD Enterprise SQL MCTS MCT Software/Web Development Consultant Cryptography/Digital Signature Consultant SQL Server 2005/2008R2/2012.
Introduction to Databases Chapter 7: Data Access and Manipulation.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Module 1: Introduction to Transact-SQL
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Graeme Malcolm | Senior Content Developer, Microsoft Geoff Allix | Principal Technologist, Content Master.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
04 | Grouping and Aggregating Data Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Concepts of Database Management Seventh Edition
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
08 | Retrieving SQL Server Metadata and Improving Query Performance Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Objectives Explain Transact-SQL
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
10 | Programming with Transact-SQL Graeme Malcolm | Senior Content Developer, Microsoft Geoff Allix | Principal Technologist, Content Master.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.

Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
06 | Modifying Data in SQL Server Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.
03 | Word Templates Brian Meier| Senior Lead Program Manager.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
05 | SET Operators, Windows Functions, and Grouping Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
04 | Business Analyzer Brian Meier| Senior Lead Program Manager.
Demo Fest of Some Leading Store Apps Module 2.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.

TSQL Worst Practices Jacob Sebastian, SQL Server MVP
There’s a particular style to it… Rob Hatton
Microsoft Virtual Academy Jamie McAllister | SharePoint MVP & Solution Architect Rob Latino | Program Manager in Office 365 Support.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
John Tran Business Program Manager, The Suddath Companies
SQL Query Getting to the data ……..
Microsoft SQL Server 2014 for Oracle DBAs Module 8
Relational Database Design
Introduction to T-SQL Querying
02 | Advanced SELECT Statements
10 | Programming with Transact-SQL
Entity Based Staging SQL Server 2012 Tyler Graham
Introduction to T-SQL Querying
Microsoft SQL Server 2014 for Oracle DBAs Module 7
Database systems Lecture 3 – SQL + CRUD
SQL Fundamentals in Three Hours
Microsoft Office 365 ProPlus Deployment for IT Pros
Contents Preface I Introduction Lesson Objectives I-2
Introduction to SQL Server and the Structure Query Language
Introduction to T-SQL Querying
Presentation transcript:

Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager

Meet Brian Alderman | MCT, Chief Executive Office, Founder MicroTechPoint Industry-recognized consultant Noted author and conference speaker Brian’s expertise and designs range across Microsoft operating systems More than 25 years of industry experience Brian has been focused on helping IT Pros and Database Administrators (DBAs) better understand core Microsoft technologies for over 25 years. A frequent presenter at SharePoint Conferences around the world, he has authored or contributed to several SharePoint, SQL Server, and other technical books, and is a MCSE, MCT, and MCITP: SharePoint and SQL Server Administrator. Brian has a BS and MS in Computer Information Systems where he graduated summa cum laude from Regis University of Colorado Springs and lives in Scottsdale, AZ where he enjoys playing golf year round and traveling around the world. LinkedIn /brianalderman Blog

Meet Tobias Ternstrom Principal Program Manager Lead in the SQL Server & Windows Azure SQL DB product group His team owns the development of the T-SQL language, type- system and server-side libraries and performance management in SQLDB Tobias describes himself as a developer, instructor and architect who has been using SQL Server since mid-90s

Querying Microsoft SQL Server 2012 Jump Start 01 | Introducing SQL Server 2012 SQL Server types of statements; other SQL statement elements; basic SELECT statements 02 | Advanced SELECT Statements DISTINCT, Aliases, scalar functions and CASE, using JOIN and MERGE; Filtering and sorting data, NULL values 03 | SQL Server Data Types Introduce data types, data type usage, converting data types, understanding SQL Server function types 04 | Grouping and Aggregating Data Aggregate functions, GROUP BY and HAVING clauses, subqueries; self-contained, correlated, and EXISTS; Views, inline-table valued functions, and derived tables | Lunch Break Eat, drink, and recharge for the afternoon session

Querying Microsoft SQL Server 2012 Jump Start 05 | SET Operators, Windows Functions, and Grouping SET operators, Windows functions, GROUPING sets (PIVOT, UNPIVOT, CUBE, ROLLUP) 06 | Modifying Data INSERT, UPDATE, and DELETE statements, use of defaults, constraints, and triggers, OUTPUT 07 | Programming with T-SQL Using T-SQL programming elements, implementing error handling, understanding and implementing transactions 08 | Retrieving SQL Server Metadata and Improving Query Performance Querying system catalogs and dynamic management views, creating and executing stored procedures, improving SQL Server query performance

01 | Introduction to Microsoft SQL Server 2012 Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager

Course Topics Querying Microsoft SQL Server 2012 Jump Start 01 | Introducing SQL Server 2012 SQL Server types of statements; other SQL statement elements; basic SELECT statements 02 | Advanced SELECT Statements DISTINCT, Aliases, scalar functions and CASE, using JOIN and MERGE; Filtering and sorting data, NULL values 03 | SQL Server Data Types Introduce data types, data type usage, converting data types, understanding SQL Server function types 04 | Grouping and Aggregating Data Aggregate functions, GROUP BY and HAVING clauses, subqueries; self-contained, correlated, and EXISTS; Views, inline-table valued functions, and derived tables | Lunch Break Eat, drink, and recharge for the afternoon session

Types of commands and statement elements Basic SELECT statements Module Overview

Commands and Statement Elements

Statements for querying and modifying data SELECT, INSERT, UPDATE, DELETE Statements for object definitions CREATE, ALTER, DROP Statements for security permissions GRANT, REVOKE, DENY Data Manipulation Language (DML*) Data Definition Language (DDL) Data Control Language (DCL) * DML with SELECT is the primary focus of this course Categories of T-SQL statements

Predicates and Operators Control of Flow Functions Expressions Variables Comments Batch Separators T-SQL language elements

T-SQL language elements: predicates and operators Elements: Predicates and Operators: Predicates IN, BETWEEN, LIKE Comparison Operators =, >, =,, !=, !>, !< Logical Operators AND, OR, NOT Arithmetic Operators +, -, *, /, % Concatenation + T-SQL enforces operator precedence

SUBSTRING LEFT, RIGHT LEN DATALENGTH REPLACE REPLICATE UPPER, LOWER RTRIM, LTRIM GETDATE SYSTDATETIME GETUTCDATE DATEADD DATEDIFF YEAR MONTH DAY SUM MIN MAX AVG COUNT String Functions Date and Time Functions Aggregate Functions T-SQL language elements: functions

T-SQL language elements: variables Local variables in T-SQL temporarily store a value of a specific data type Name begins with sign reserved for system functions Assigned a data type Must be declared and used within the same batch In SQL Server 2008 and later, can declare and initialize in the same statement int = 30;

T-SQL language elements: expressions Combination of identifiers, values, and operators evaluated to obtain a single result Can be used in SELECT statements SELECT clause WHERE clause Can be single constant, single-valued function, or variable Can be combined if expressions have same the data type SELECT YEAR(OrderDate) SELECT OrderQty * UnitPrice...

T-SQL language elements: batch separators Batches are sets of commands sent to SQL Server as a unit Batches determine variable scope, name resolution To separate statements into batches, use a separator: SQL Server tools use the GO keyword GO is not a SQL Server T-SQL command

T-SQL language elements: control of flow, errors, and transactions Allow you to control the flow of execution within code, handle errors, and maintain transactions Used in programmatic code objects Stored procedures, triggers, statement blocks TRY...CATCH IF...ELSE WHILE BREAK CONTINUE BEGIN...END BEGIN TRANSACTION COMMIT TRANSACTION ROLLBACK TRANSACTION Control of FlowError Handling Transaction Control

T-SQL language elements: comments Marks T-SQL code as a comment: For a block, enclose it between /* and */ characters For inline text, precede the comments with -- T-SQL Editors such as SSMS will typically color-code comments, as shown above /* This is a block of commented code */ /* This is a block of commented code */ --This line of text will be ignored

Logical query processing The order in which a query is written is not the order in which it is evaluated by SQL Server. 5: SELECT 1: FROM 2: WHERE 3: GROUP BY 4: HAVING 6: ORDER BY

USE AdventureWorks2012; SELECT SalesPersonID, YEAR(OrderDate) AS OrderYear FROM Sales.SalesOrderHeader WHERE CustomerID = GROUP BY SalesPersonID, YEAR(OrderDate) HAVING COUNT(*) > 1 ORDER BY SalesPersonID, OrderYear; USE AdventureWorks2012; SELECT SalesPersonID, YEAR(OrderDate) AS OrderYear FROM Sales.SalesOrderHeader WHERE CustomerID = GROUP BY SalesPersonID, YEAR(OrderDate) HAVING COUNT(*) > 1 ORDER BY SalesPersonID, OrderYear; Applying the logical order of operations to writing SELECT statements USE AdventureWorks2012; SELECT SalesPersonID, YEAR(OrderDate) AS OrderYear FROM Sales.SalesOrderHeader WHERE CustomerID = GROUP BY SalesPersonID, YEAR(OrderDate) HAVING COUNT(*) > 1 ORDER BY SalesPersonID, OrderYear; USE AdventureWorks2012; SELECT SalesPersonID, YEAR(OrderDate) AS OrderYear FROM Sales.SalesOrderHeader WHERE CustomerID = GROUP BY SalesPersonID, YEAR(OrderDate) HAVING COUNT(*) > 1 ORDER BY SalesPersonID, OrderYear;

Basic SELECT Statements

Elements of the SELECT statement

Retrieving columns from a table or view Use SELECT with column list to display columns Use FROM to specify a source table or view Specify both schema and table names Delimit names if necessary End all statements with a semicolon SELECT CustomerID, StoreID FROM Sales.Customer; SELECT CustomerID, StoreID FROM Sales.Customer;

Using calculations in the SELECT clause Calculations are scalar, returning one value per row Using scalar expressions in the SELECT clause SELECT unitprice, OrderQty, (unitprice * OrderQty) FROM sales.salesorderdetail; SELECT unitprice, OrderQty, (unitprice * OrderQty) FROM sales.salesorderdetail;

Writing basic SELECT statements Demo

Summary Three types of command used to manage SQL server objects and security include; DDL, DML, and DCL T-SQL language elements include; Predicates and operators – BETWEEN, LIKE, NOT, >=, * Functions – string, date and time, aggregate Variables – local has system has two Expressions – identifiers, values, and operators Batch separators – GO used to separate statements Control-of-flow – IF…ELSE, WHILE, CONTINUE Comments - /* to start */ to end; can also use --

Summary Predicate logic is a property or expression that is either true or false. Also referred to as a Boolean expression Elements of a SELECT statement and the order they are evaluated : 1. FROM 2. WHERE 3. GROUP BY 4. HAVING 5. SELECT 6. ORDER BY

©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.