| Foreword |
|
vii | |
| Preface |
|
ix | |
|
|
|
1 | (8) |
|
Kinds of Database Systems |
|
|
1 | (1) |
|
|
|
2 | (3) |
|
Tables, Rows, and Columns |
|
|
2 | (2) |
|
|
|
4 | (1) |
|
|
|
5 | (1) |
|
|
|
5 | (4) |
|
|
|
9 | (14) |
|
|
|
9 | (1) |
|
|
|
10 | (1) |
|
|
|
11 | (6) |
|
|
|
11 | (3) |
|
The Structure of SQL Statements |
|
|
14 | (1) |
|
|
|
15 | (2) |
|
|
|
17 | (4) |
|
Organization of the Examples |
|
|
21 | (2) |
|
Retrieving Data from a Table: The Select Statement |
|
|
23 | (38) |
|
Selecting Specific Columns in a Table |
|
|
23 | (4) |
|
Selecting All Columns in a Table |
|
|
27 | (3) |
|
Selecting Only Some of a Table's Records: The Where Clause |
|
|
30 | (1) |
|
Comparisons in a Where Clause |
|
|
30 | (6) |
|
Combining Predicates in a Where Clause |
|
|
36 | (8) |
|
|
|
36 | (3) |
|
|
|
39 | (3) |
|
|
|
42 | (2) |
|
|
|
44 | (17) |
|
|
|
44 | (4) |
|
|
|
48 | (5) |
|
|
|
53 | (4) |
|
|
|
57 | (4) |
|
|
|
61 | (36) |
|
|
|
61 | (6) |
|
Doing Arithmetic with Selected Information |
|
|
67 | (3) |
|
|
|
70 | (15) |
|
Finding Maximum and Minimum Values |
|
|
70 | (4) |
|
|
|
74 | (3) |
|
|
|
77 | (2) |
|
|
|
79 | (3) |
|
|
|
82 | (3) |
|
|
|
85 | (8) |
|
More on Grouping: The Having Clause |
|
|
93 | (4) |
|
Retrieving Data from Several Tables: Joins |
|
|
97 | (50) |
|
|
|
97 | (2) |
|
|
|
99 | (3) |
|
Restricting the Results of a Join |
|
|
102 | (2) |
|
|
|
104 | (3) |
|
Joining Tables Using the Join Operator |
|
|
107 | (4) |
|
Manipulating the Results of a Join |
|
|
111 | (4) |
|
|
|
115 | (5) |
|
|
|
120 | (12) |
|
The Visual Approach with More Than Two Tables |
|
|
120 | (12) |
|
Joins with More Than Three Tables |
|
|
132 | (8) |
|
Retrieving the Same Information in Different Ways |
|
|
132 | (8) |
|
|
|
140 | (7) |
|
Queries within Queries: Subqueries |
|
|
147 | (26) |
|
|
|
147 | (4) |
|
Using Comparison Operators with Subqueries |
|
|
151 | (4) |
|
|
|
155 | (7) |
|
|
|
162 | (1) |
|
|
|
162 | (11) |
|
Using Having with Correlated Subqueries |
|
|
164 | (9) |
|
Creating and Destroying Tables |
|
|
173 | (12) |
|
|
|
173 | (9) |
|
|
|
175 | (1) |
|
Requiring Unique Values in a Column |
|
|
175 | (7) |
|
Destroying (Dropping) Tables |
|
|
182 | (3) |
|
Adding, Modifying, and Deleting Records |
|
|
185 | (20) |
|
Adding Records to a Table |
|
|
185 | (15) |
|
Adding Records with Values Only for Some Columns |
|
|
187 | (3) |
|
Adding Records Using Select |
|
|
190 | (3) |
|
Modifying Records in a Table |
|
|
193 | (7) |
|
Deleting Records from a Table |
|
|
200 | (5) |
|
|
|
205 | (24) |
|
|
|
205 | (9) |
|
Creating Views Based on One Table |
|
|
206 | (5) |
|
Creating Views Based on More Than One Table |
|
|
211 | (3) |
|
|
|
214 | (12) |
|
Selecting Records from a View |
|
|
214 | (5) |
|
|
|
219 | (3) |
|
Modifying Records in a View |
|
|
222 | (2) |
|
Deleting Records from a View |
|
|
224 | (2) |
|
Destroying (Dropping) Views |
|
|
226 | (3) |
|
Granting and Revoking Privileges |
|
|
229 | (20) |
|
|
|
229 | (14) |
|
Granting Privileges on Views |
|
|
231 | (9) |
|
Passing Privileges On: The Grant Option |
|
|
240 | (3) |
|
|
|
243 | (6) |
|
|
|
249 | (28) |
|
|
|
249 | (4) |
|
|
|
250 | (2) |
|
|
|
252 | (1) |
|
|
|
253 | (1) |
|
Using Multiple SQL Statements to Solve a Problem |
|
|
253 | (12) |
|
|
|
265 | (6) |
|
|
|
271 | (2) |
|
Joining a Table with Itself |
|
|
273 | (3) |
|
|
|
276 | (1) |
| Appendix A The Example Database |
|
277 | (2) |
| Appendix B List of Examples |
|
279 | (4) |
| Appendix C The Example Database |
|
283 | (2) |
| Index |
|
285 | |