Base De Datos

Páginas: 46 (11360 palabras) Publicado: 1 de noviembre de 2012
®

Microsoft SQL Server
2008 T-SQL
Fundamentals

Itzik Ben-Gan
(Solid Quality Mentors)

To learn more about this book, visit Microsoft Learning at
http://www.microsoft.com/MSPress/books/12806.aspx

9780735626010

© 2009 Itzik Ben-Gan. All rights reserved.

®

Table of Contents
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . .xiii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

1 Background to T-SQL Querying and Programming. . . . . . . . . . . . 1
Theoretical Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
SQL . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Set Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Predicate Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
The Relational Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 5
The Data Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
SQL Server Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
SQL Server Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Databases . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Schemas and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Creating Tables and Defining Data Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Creating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . 19
Defining Data Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

2 Single-Table Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Elements of the SELECT Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
The FROM Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
The WHERE Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
The GROUP BY Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . 30
The HAVING Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
The SELECT Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
The ORDER BY Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
The TOP Option . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
The OVER Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Predicates and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

What do you think of this book? We want to hear from you!
Microsoft is interested in hearing yourfeedback so we can continually improve our books and learning
resources for you. To participate in a brief online survey, please visit:

www.microsoft.com/learning/booksurvey/

vii

A05C626010.indd vii

9/16/2008 5:43:26 PM

viii

Table of Contents

CASE Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
NULLs . ....
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Que es una base de datos y tipos de base de datos
  • Bases de datos y usuarios de bases de datos
  • Base De Datos
  • Base De Datos
  • Base de datos
  • Base De Datos
  • Base de datos
  • Bases de datos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS