君子务本,本立而道生——《临沂大学优秀校本教材》总序 韩延明 1
Introduction to SQL Server 2005 1
Unit 1 What Makes Up a SQL Server Database? 1
1.1 An Overview of Database Objects 1
1.2 The Database Object 2
1.3 SQL Server Identifiers for Objects 10
Summary 11
Exercises 11
Unit 2 How to Use Tools of SQL Server 12
2.1 Creating a Database in Microsoft SQL Server 2005 13
2.2 The Query Editor 17
2.3 Entering a SQL Query or Statement 24
2.4 The Scripts of SQL Server2005_load.sql 27
Review Questions 43
Exercises 43
Uint 3 The Foundation Statements of T-SQL 44
3.1 Getting Started with a Basic SELECT Statement 45
3.2 Adding Data with the INSERT Statement 52
3.3 Changing What You've Got with the UPDATE Statement 53
3.4 The DELETE Statement 54
Summary 54
Review Questions 55
Exercise 56
Unit 4 Joins 58
4.1 INNER JOIN 58
4.2 The OUTER JOIN 62
4.3 CROSS JOINs 63
Summary 63
Review Questions 63
Exercises 64
Unit 5 Subquery 67
5.1 What Is a Subquery? 67
5.2 Introducing Set Operations 71
Summary 73
Review Questions 73
Exercises 74
Unit 6 Creating and Altering Tables 81
6.1 Object Names in SQL Server 81
6.2 CREATE DATABASE 82
6.3 Data Types in SQL Server 2005 86
6.4 Creating a Table 88
6.5 The ALTER TABLE Command 89
Summary 90
Review Questions 90
Exercises 91
Unit 7 Functions 93
7.1 Aggregate Functions 94
7.2 Row-Level Functions 95
7.3 Other Functions 96
Summary 104
Review Questions 105
Exercises 106
Unit 8 Indexes and Constraints on Tables 110
8.1 Indexes 110
8.2 How Data Is Accessed in SQL Server 110
8.3 CREATE INDEX 111
8.4 Constraints 112
Summary 118
Review Questions 118
Exercises 119
Unit 9 Views 122
9.1 Creating views 123
9.2 Using views 123
Summary 124
Review Questions 125
Exercises 125
Unit 10 Programming Basics and Stored Procedures 127
10.1 Declaring Variables 128
10.2 Control-of-Flow Statements 128
10.3 Stored Procedures 132
Summary 137
Exercises 137
Unit 11 Triggers 139
11.1 What Is a Trigger? 139
11.2 Using Triggers 140
11.3 Dropping Triggers 150
Summary 150
Exercises 150
Unit 12 User Defined Functions 151
12.1 What a UDF Is 151
12.2 Using UDF 152
Summary 154
Unit 13 Transactions 156
13.1 What is a Transaction? 156
13.2 Transactions 156
Summary 158
Exercises 159
References 160