Hihahi

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

viii Microsoft SQL Server 2019: A Beginner’s Guide

Transact-SQL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74


Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
Scalar Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
Scalar Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
NULL Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
Chapter 5 Data Definition Language. . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Creating Database Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Creation of a Database. . . . . . . . . . . . . . . . . . . . . . . . . . . .88
CREATE TABLE: A Basic Form . . . . . . . . . . . . . . . . . . . . . .91
CREATE TABLE and Declarative Integrity Constraints . . . . . . . .93
Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98
Creating Other Database Objects . . . . . . . . . . . . . . . . . . . . 101
Integrity Constraints and Domains . . . . . . . . . . . . . . . . . . . 102
Modifying Database Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Altering a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Altering a Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Removing Database Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Chapter 6 Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
SELECT Statement: Its Clauses and Functions . . . . . . . . . . . . . . . . 115
WHERE Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
GROUP BY Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
HAVING Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
ORDER BY Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
SELECT Statement and IDENTITY Property . . . . . . . . . . . . . 139
CREATE SEQUENCE Statement . . . . . . . . . . . . . . . . . . . . 140
Set Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
CASE Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Subqueries and Comparison Operators . . . . . . . . . . . . . . . . . 149
Subqueries and the IN Operator . . . . . . . . . . . . . . . . . . . . . 150
Subqueries and ANY and ALL Operators. . . . . . . . . . . . . . . . 151
Temporary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Join Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Two Syntax Forms to Implement Joins . . . . . . . . . . . . . . . . . 154
Natural Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Cartesian Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Outer Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Further Forms of Join Operations . . . . . . . . . . . . . . . . . . . . 162

You might also like