Acknowledgments |
|
xi | |
Introduction |
|
xi | |
|
PART I Relational Databases and SQL |
|
|
|
Introduction to Relational Databases and SQL |
|
|
3 | (26) |
|
Understand Relational Databases |
|
|
4 | (11) |
|
|
5 | (10) |
|
|
15 | (14) |
|
|
15 | (3) |
|
|
18 | (1) |
|
|
19 | (2) |
|
SQL Standard versus Product Implementations |
|
|
21 | (8) |
|
Working with the SQL Environment |
|
|
29 | (20) |
|
Understand the SQL Environment |
|
|
30 | (2) |
|
|
32 | (8) |
|
|
34 | (1) |
|
|
35 | (2) |
|
|
37 | (3) |
|
Name Objects in an SQL Environment |
|
|
40 | (2) |
|
|
41 | (1) |
|
|
42 | (2) |
|
|
44 | (5) |
|
Creating and Altering Tables |
|
|
49 | (24) |
|
|
50 | (4) |
|
Specify Column Data Types |
|
|
54 | (9) |
|
|
55 | (2) |
|
|
57 | (1) |
|
|
58 | (2) |
|
|
60 | (1) |
|
|
61 | (1) |
|
|
62 | (1) |
|
Create User-Defined Types |
|
|
63 | (1) |
|
Specify Column Default Values |
|
|
64 | (5) |
|
|
69 | (4) |
|
|
73 | (30) |
|
Understand Integrity Constraints |
|
|
74 | (2) |
|
|
76 | (1) |
|
|
77 | (2) |
|
Add PRIMARY KEY Constraints |
|
|
79 | (4) |
|
Add FOREIGN KEY Constraints |
|
|
83 | (12) |
|
|
88 | (1) |
|
The <referential triggered action> Clause |
|
|
89 | (6) |
|
|
95 | (8) |
|
|
97 | (1) |
|
Creating Domains and Domain Constraints |
|
|
98 | (5) |
|
|
103 | (20) |
|
Add Views to the Database |
|
|
104 | (10) |
|
|
108 | (6) |
|
|
114 | (3) |
|
Using the WITH CHECK OPTION Clause |
|
|
116 | (1) |
|
Drop Views from the Database |
|
|
117 | (6) |
|
Managing Database Security |
|
|
123 | (22) |
|
Understand the SQL Security Model |
|
|
124 | (6) |
|
|
126 | (2) |
|
Accessing Database Objects |
|
|
128 | (2) |
|
|
130 | (1) |
|
Grant and Revoke Privileges |
|
|
131 | (6) |
|
|
135 | (2) |
|
|
137 | (8) |
|
|
138 | (7) |
|
PART II Data Access and Modification |
|
|
|
|
145 | (30) |
|
Use a SELECT Statement to Retrieve Data |
|
|
147 | (5) |
|
The SELECT Clause and FROM Clause |
|
|
147 | (5) |
|
Use the WHERE Clause to Define Search Conditions |
|
|
152 | (7) |
|
Defining the WHERE Clause |
|
|
156 | (3) |
|
Use the GROUP BY Clause to Group Query Results |
|
|
159 | (5) |
|
Use the HAVING Clause to Specify Group Search Conditions |
|
|
164 | (2) |
|
Use the ORDER BY Clause to Sort Query Results |
|
|
166 | (9) |
|
|
175 | (18) |
|
|
176 | (6) |
|
Inserting Values from a SELECT Statement |
|
|
180 | (2) |
|
|
182 | (4) |
|
Updating Values from a SELECT Statement |
|
|
185 | (1) |
|
|
186 | (7) |
|
|
193 | (32) |
|
|
194 | (6) |
|
Using the BETWEEN Predicate |
|
|
199 | (1) |
|
|
200 | (3) |
|
|
203 | (6) |
|
Reference Additional Sources of Data |
|
|
209 | (7) |
|
|
209 | (4) |
|
Using the EXISTS Predicate |
|
|
213 | (3) |
|
Quantify Comparison Predicates |
|
|
216 | (9) |
|
Using the SOME and ANY Predicates |
|
|
216 | (2) |
|
|
218 | (7) |
|
Working with Functions and Value Expressions |
|
|
225 | (28) |
|
|
226 | (6) |
|
|
227 | (2) |
|
Using the MAX and MIN Functions |
|
|
229 | (2) |
|
|
231 | (1) |
|
|
232 | (1) |
|
|
232 | (6) |
|
Working with String Value Functions |
|
|
233 | (3) |
|
Working with Datetime Value Functions |
|
|
236 | (2) |
|
|
238 | (7) |
|
Working with Numeric Value Expressions |
|
|
238 | (3) |
|
Using the CASE Value Expression |
|
|
241 | (3) |
|
Using the CAST Value Expression |
|
|
244 | (1) |
|
|
245 | (8) |
|
Accessing Multiple Tables |
|
|
253 | (24) |
|
Perform Basic Join Operations |
|
|
254 | (7) |
|
|
257 | (1) |
|
Creating Joins with More than Two Tables |
|
|
258 | (1) |
|
|
259 | (1) |
|
|
260 | (1) |
|
Join Tables with Shared Column Names |
|
|
261 | (2) |
|
Creating the Natural Join |
|
|
262 | (1) |
|
Creating the Named Column Join |
|
|
263 | (1) |
|
|
263 | (6) |
|
|
264 | (2) |
|
|
266 | (3) |
|
|
269 | (8) |
|
Using Subqueries to Access and Modify Data |
|
|
277 | (22) |
|
Create Subqueries That Return Multiple Rows |
|
|
278 | (5) |
|
|
279 | (2) |
|
Using the EXISTS Predicate |
|
|
281 | (1) |
|
Using Quantified Comparison Predicates |
|
|
282 | (1) |
|
Create Subqueries That Return One Value |
|
|
283 | (1) |
|
Work with Correlated Subqueries |
|
|
284 | (2) |
|
|
286 | (2) |
|
Use Subqueries to Modify Data |
|
|
288 | (11) |
|
Using Subqueries to Insert Data |
|
|
288 | (2) |
|
Using Subqueries to Update Data |
|
|
290 | (1) |
|
Using Subqueries to Delete Data |
|
|
291 | (8) |
|
PART III Advanced Data Access |
|
|
|
Creating SQL-Invoked Routines |
|
|
299 | (30) |
|
Understand SQL-Invoked Routines |
|
|
300 | (3) |
|
SQL-Invoked Procedures and Functions |
|
|
301 | (1) |
|
Working with the Basic Syntax |
|
|
301 | (2) |
|
Create SQL-Invoked Procedures |
|
|
303 | (3) |
|
Invoking SQL-Invoked Procedures |
|
|
305 | (1) |
|
Add Input Parameters to Your Procedures |
|
|
306 | (5) |
|
Using Procedures to Modify Data |
|
|
309 | (2) |
|
Add Local Variables to Your Procedures |
|
|
311 | (2) |
|
Work with Control Statements |
|
|
313 | (7) |
|
Create Compound Statements |
|
|
313 | (1) |
|
Create Conditional Statements |
|
|
314 | (2) |
|
Create Looping Statements |
|
|
316 | (4) |
|
Add Output Parameters to Your Procedures |
|
|
320 | (1) |
|
Create SQL-Invoked Functions |
|
|
321 | (8) |
|
|
329 | (22) |
|
|
330 | (3) |
|
Trigger Execution Context |
|
|
331 | (2) |
|
|
333 | (3) |
|
Referencing Old and New Values |
|
|
334 | (1) |
|
|
335 | (1) |
|
|
336 | (2) |
|
|
338 | (5) |
|
|
343 | (8) |
|
|
351 | (26) |
|
|
352 | (3) |
|
Declaring and Opening SQL Cursors |
|
|
353 | (2) |
|
|
355 | (8) |
|
Working with Optional Syntax Elements |
|
|
356 | (4) |
|
Creating a Cursor Declaration |
|
|
360 | (3) |
|
|
363 | (1) |
|
Retrieve Data from a Cursor |
|
|
363 | (5) |
|
Use Positioned UPDATE and DELETE Statements |
|
|
368 | (9) |
|
Using the Positioned UPDATE Statement |
|
|
368 | (2) |
|
Using the Positioned DELETE Statement |
|
|
370 | (7) |
|
Managing SQL Transactions |
|
|
377 | (26) |
|
Understand SQL Transactions |
|
|
378 | (3) |
|
Set Transaction Properties |
|
|
381 | (8) |
|
Specifying an Isolation Level |
|
|
382 | (5) |
|
Specifying a Diagnostics Size |
|
|
387 | (1) |
|
Creating a SET TRANSACTION Statement |
|
|
388 | (1) |
|
|
389 | (1) |
|
Set Constraint Deferability |
|
|
390 | (2) |
|
Create Savepoints in a Transaction |
|
|
392 | (3) |
|
|
394 | (1) |
|
|
395 | (8) |
|
|
395 | (1) |
|
Rolling Back a Transaction |
|
|
396 | (7) |
|
Accessing SQL Data from Your Host Program |
|
|
403 | (30) |
|
|
404 | (2) |
|
Embed SQL Statements in Your Program |
|
|
406 | (11) |
|
Creating an Embedded SQL Statement |
|
|
407 | (1) |
|
Using Host Variables in Your SQL Statements |
|
|
408 | (3) |
|
|
411 | (2) |
|
|
413 | (4) |
|
Create SQL Client Modules |
|
|
417 | (2) |
|
Defining SQL Client Modules |
|
|
418 | (1) |
|
Use an SQL Call-Level Interface |
|
|
419 | (14) |
|
|
421 | (2) |
|
|
423 | (1) |
|
Working with Host Variables |
|
|
424 | (2) |
|
|
426 | (7) |
|
|
433 | (86) |
|
|
434 | (3) |
|
|
437 | (12) |
|
|
437 | (2) |
|
|
439 | (2) |
|
|
441 | (8) |
|
|
|
|
449 | (42) |
|
|
491 | (6) |
|
|
492 | (2) |
|
|
494 | (3) |
|
SQL Code Used in Try This Exercises |
|
|
497 | (22) |
|
SQL Code by Try This Exercise |
|
|
498 | (16) |
|
|
514 | (5) |
Index |
|
519 | |