43
Querying Microsoft SQL Server 2012 Consultas en MS SQL Server 2012

Consultas en MS SQL Server 2012

Embed Size (px)

Citation preview

Page 1: Consultas en MS SQL Server 2012

Querying Microsoft SQL Server 2012Consultas en MS SQL Server 2012

Page 2: Consultas en MS SQL Server 2012
Page 3: Consultas en MS SQL Server 2012

Ven Señor, sobre nuestros pensamientos, palabras y obras, a fin de que nuestro dia se agradable ante tus ojos.

Querido Dios abre sus ojos para que se salven y dejen la ignorancia y las ensenñanzas que han recibido.

Beshir Estefanos Kamel

Page 4: Consultas en MS SQL Server 2012

El verdadero tesoroLa lámpara del cuerpo es el ojo; por eso, si tu ojo está sano, todo tu cuerpo estará lleno de luz. Pero si tu ojo está malo, todo tu cuerpo estará lleno de oscuridad. Así que, si la luz que hay en ti es oscuridad, ¡cuán grande será la oscuridad!

Mateo 6:22

Page 5: Consultas en MS SQL Server 2012

Profesor de POO y Bases de Datos.

[email protected]@dae.una.edu.ni

Page 6: Consultas en MS SQL Server 2012

Cronograma• Todos los jueves• 5:30 pm – 8:00 pm

Page 7: Consultas en MS SQL Server 2012

Expectativas• Audiencia– Con conocimientos básico e intermedio en MS SQL Server– Personas que estan considerando tomar el examen 70-461

;• Material Adicional–Microsoft Official Course 20461• Querying Microsoft SQL Server• Charla preparatoria para la certificación de Microsoft: Exa

men 461

Page 8: Consultas en MS SQL Server 2012

• Microsoft Virtual Academy– Cursos en linea dirigidos por profesionales– Actualmente se encuentran registrados mas de 3M de

usuarios– Información actualizada y con una variedad de productos

MS– Cursos relacionados• Querying with Transact-SQL• Database Fundamentals

Unete a la comunidad MVA

Page 9: Consultas en MS SQL Server 2012

Otras fuentes 1/2• Sitios que venden el servicio de entrenamiento– Learn on line– Pluralsight– Lynda

Page 11: Consultas en MS SQL Server 2012

Course Topics1. Querying Microsoft SQL server 2012 with transact sql01 | Foundations of Querying 07 | Querying and Managing XML

Data02 | Getting Started with the SELECT Statement

08 | Creating Tables and Enforcing Data Integrity

03 | Filtering and Sorting Data 09 | Designing and Creating Views, Inline Functions, and Synonyms

04 | Combining Sets 10 | Inserting, Updating, and Deleting Data

05 | Grouping and Windowing 11 | Other Data Modification Aspects

06 | Querying Full-Text Data 12 | Implementing Transactions, Error Handling, and Dynamic SQL

Page 12: Consultas en MS SQL Server 2012

Click to edit Master subtitle style

01 | Foundations of Querying

[email protected] | Instructor

Page 13: Consultas en MS SQL Server 2012

Module Overview01 | Foundations of Querying• Lesson 1: Understanding the Foundations of T-SQL

– Evolution of T-SQL– Using T-SQL in a Relational Way– Using Correct Terminology

• Lesson 2: Understanding Logical Query Processing– T-SQL As a Declarative English-Like Language– Logical Query Processing Phases

Page 14: Consultas en MS SQL Server 2012

Click to edit Master subtitle style02 | Getting Started with the

SELECT Statement

[email protected] | Instructor

Page 15: Consultas en MS SQL Server 2012

Module Overview02 | Getting Started with the SELECT Statement• Lesson 1: Using the FROM and SELECT Clauses

– The FROM Clause– The SELECT Clause– Delimiting Identifiers

• Lesson 2: Working with Data Types and Built-in Functions– Choosing the Appropriate Data Type– Choosing a Data Type for Keys– Date and Time Functions– Character Functions– CASE Expression and Related Functions

Page 16: Consultas en MS SQL Server 2012

Click to edit Master subtitle style

03 | Filtering and Sorting Data

[email protected] | Instructor

Page 17: Consultas en MS SQL Server 2012

Module Overview03 | Filtering and Sorting Data• Lesson 1: Filtering Data with Predicates

– Predicates, Three-Valued Logic, and Search Arguments– Combining Predicates– Filtering Character Data– Filtering Date and Time Data

• Lesson 2: Sorting Data– Understanding When Order Is Guaranteed– Using the ORDER BY Clause to Sort Data

• Lesson 3: Filtering Data with TOP and OFFSET-FETCH– Filtering Data with TOP– Filtering Data with OFFSET-FETCH

Page 18: Consultas en MS SQL Server 2012

Click to edit Master subtitle style

04 | Combining Sets

[email protected] | Instructor

Page 19: Consultas en MS SQL Server 2012

Module Overview04 | Combining Sets• Lesson 1: Using Joins

– Cross Joins– Inner Joins– Outer Joins– Multi-Join Queries

• Lesson 2: Using Subqueries, Table Expressions, and the APPLY– Operator– Subqueries– Table Expressions– APPLY– Lesson 3: Using Set Operators– UNION and UNION ALL– INTERSECT– EXCEPT

Page 20: Consultas en MS SQL Server 2012

Click to edit Master subtitle style

05 | Grouping and Windowing

[email protected] | Instructor

Page 21: Consultas en MS SQL Server 2012

Module Overview05 | Grouping and Windowing• Lesson 1: Writing Grouped Queries

– Working with a Single Grouping Set– Working with Multiple Grouping Sets

• Lesson 2: Pivoting and Unpivoting Data– Pivoting Data– Unpivoting Data

• Lesson 3: Using Window Functions– Window Aggregate Functions– Window Ranking Functions– Window Offset Functions

Page 22: Consultas en MS SQL Server 2012

Click to edit Master subtitle style

06 | Querying Full-Text Data

[email protected] | Instructor

Page 23: Consultas en MS SQL Server 2012

Module Overview06 | Querying Full-Text Data• Lesson 1: Creating Full-Text Catalogs and Indexes

– Full-Text Search Components– Creating and Managing Full-Text Catalogs and Indexes

• Lesson 2: Using the CONTAINS and FREETEXT Predicates– The CONTAINS Predicate– The FREETEXT Predicate

• Lesson 3: Using the Full-Text and Semantic Search– Table-Valued Functions– Using the Full-Text Search Functions– Using the Semantic Search Functions

Page 24: Consultas en MS SQL Server 2012

Click to edit Master subtitle style07 | Querying and Managing XML

Data

[email protected] | Instructor

Page 25: Consultas en MS SQL Server 2012

Module Overview07 | Querying and Managing XML Data• Lesson 1: Returning Results As XML with FOR XML

– Introduction to XML– Producing XML from Relational Data– Shredding XML to Tables

• Lesson 2: Querying XML Data with XQuery– XQuery Basics– Navigation– FLWOR Expressions

• Lesson 3: Using the XML Data Type– When to Use the XML Data Type– XML Data Type Methods– Using the XML Data Type for Dynamic Schema

Page 26: Consultas en MS SQL Server 2012

Click to edit Master subtitle style08 | Creating Tables and Enforcing

Data Integrity

[email protected] | Instructor

Page 27: Consultas en MS SQL Server 2012

Module Overview08 | Creating Tables and Enforcing Data Integrity• Lesson 1: Creating and Altering Tables

– Introduction– Creating a Table– Altering a Table– Choosing Table Indexes

• Lesson 2: Enforcing Data Integrity– Using Constraints– Primary Key Constraints– Unique Constraints– Foreign Key Constraints– Check Constraints– Default Constraints

Page 28: Consultas en MS SQL Server 2012

Click to edit Master subtitle style09 | Designing and Creating Views,

Inline Functions, and Synonyms

[email protected] | Instructor

Page 29: Consultas en MS SQL Server 2012

Module Overview09 | …Views, Inline Functions, and Synonyms• Lesson 1: Designing and Implementing Views and Inline Functions

– Introduction– Views– Inline Functions

• Lesson 2: Using Synonyms– Creating a Synonym– Comparing Synonyms with Other Database Objects

Page 30: Consultas en MS SQL Server 2012

Click to edit Master subtitle style10 | Inserting, Updating, and

Deleting Data

[email protected] | Instructor

Page 31: Consultas en MS SQL Server 2012

• Lesson 1: Inserting Data– Sample Data– INSERT VALUES– INSERT SELECT– INSERT EXEC– SELECT INTO

• Lesson 2: Updating Data– Sample Data– UPDATE Statement– UPDATE Based on Join– Nondeterministic UPDATE– UPDATE and Table Expressions– UPDATE Based on a Variable– UPDATE All-at-Once

• Lesson 3: Deleting Data– Sample Data– DELETE Statement– TRUNCATE Statement– DELETE Based on a Join– DELETE Using Table Expressions

Module Overview10 | Inserting, Updating, and Deleting Data

Page 32: Consultas en MS SQL Server 2012

Click to edit Master subtitle style11 | Other Data Modification

Aspects

[email protected] | Instructor

Page 33: Consultas en MS SQL Server 2012

Module Overview11 | Other Data Modification Aspects• Lesson 1: Using the Sequence Object and IDENTITY Column Property.

– Using the IDENTITY Column Property– Using the Sequence Object

• Lesson 2: Merging Data– Using the MERGE Statement

• Lesson 3: Using the OUTPUT Option– Working with the OUTPUT Clause– INSERT with OUTPUT– DELETE with OUTPUT– UPDATE with OUTPUT– MERGE with OUTPUT– Composable DML

Page 34: Consultas en MS SQL Server 2012

Click to edit Master subtitle style12 | Implementing Transactions,

Error Handling, and Dynamic SQL

[email protected] | Instructor

Page 35: Consultas en MS SQL Server 2012

Module Overview12 | …Transactions, Error Handling, and Dynamic SQL

• Lesson 1: Managing Transactions and Concurrency– Understanding Transactions– Types of Transactions– Basic Locking– Transaction Isolation Levels

• Lesson 2: Implementing Error Handling– Detecting and Raising Errors– Handling Errors After Detection– Lesson 3: Using Dynamic SQL– Dynamic SQL Overview– SQL Injection– Using sp_executesql

Page 36: Consultas en MS SQL Server 2012

Click to edit Master subtitle style13 | Designing and Implementing

T-SQL Routines

[email protected] | Instructor

Page 37: Consultas en MS SQL Server 2012

• Lesson 1: Designing and Implementing Stored Procedures– Understanding Stored Procedures– Executing Stored Procedures– Branching Logic– Developing Stored Procedures

• Lesson 2: Implementing Triggers– DML Triggers– AFTER Triggers– INSTEAD OF Triggers– DML Trigger Functions

• Lesson 3: Implementing User-Defined Functions– Understanding User-Defined

Functions– Scalar UDFs– Table-Valued UDFs– Limitations on UDFs– UDF Options– UDF Performance Considerations

Module Overview13 | Designing and Implementing T-SQL Routines

Page 38: Consultas en MS SQL Server 2012

Click to edit Master subtitle style14 | Using Tools to Analyze Query

Performance

[email protected] | Instructor

Page 39: Consultas en MS SQL Server 2012

Click to edit Master subtitle style17 | Implementing Indexes and

Statistics

[email protected] | Instructor

Page 40: Consultas en MS SQL Server 2012

Click to edit Master subtitle style16 | Understanding Cursors, Sets,

and Temporary Tables

[email protected] | Instructor

Page 41: Consultas en MS SQL Server 2012

Module Overview16 | … Cursors, Sets, and Temporary Tables• Lesson 1: Evaluating the Use of Cursor/Iterative Solutions vs. Set-Based

Solutions– The Meaning of "Set-Based"– Iterations for Operations That Must Be Done Per Row– Cursor vs. Set-Based Solutions for Data Manipulation Tasks

• Lesson 2: Using Temporary Tables vs. Table Variables– Scope– DDL and Indexes– Physical Representation in tempdb– Transactions– Statistics

Page 42: Consultas en MS SQL Server 2012

©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.

Page 43: Consultas en MS SQL Server 2012

CRUDCRUD SQLCreate InsertRead SelectUpdate UpdateDelete Delete