Acknowledgments |
|
xix | |
Introduction |
|
xxi | |
About This Book |
|
xxii | |
Who Is This Book For? |
|
xxiv | |
SQL in MySQL vs. SQL in Other Database Systems |
|
xxiv | |
Using the Online Resources |
|
xxiv | |
|
|
1 | (24) |
|
1 Installing Mysql And Tools |
|
|
3 | (6) |
|
|
4 | (1) |
|
|
4 | (3) |
|
|
7 | (2) |
|
2 Creating Databases And Tables |
|
|
9 | (16) |
|
|
9 | (2) |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (8) |
|
|
21 | (1) |
|
Dropping and Altering Tables |
|
|
22 | (1) |
|
|
23 | (2) |
|
PART II SELECTING DATA FROM A MYSQL DATABASE |
|
|
25 | (132) |
|
|
27 | (10) |
|
Querying Data from a Table |
|
|
28 | (1) |
|
Using the Wildcard Character |
|
|
29 | (1) |
|
|
29 | (2) |
|
|
31 | (1) |
|
|
32 | (1) |
|
|
32 | (1) |
|
|
33 | (2) |
|
|
35 | (1) |
|
|
36 | (1) |
|
|
37 | (14) |
|
|
38 | (1) |
|
|
38 | (1) |
|
|
39 | (1) |
|
|
40 | (1) |
|
|
40 | (1) |
|
Tinytext, text, mediumtext, and longtext |
|
|
40 | (3) |
|
|
43 | (1) |
|
Tinyblob, blob, mediumblob, and longblob |
|
|
43 | (1) |
|
|
43 | (1) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
44 | (1) |
|
Tinyint, smallint, mediumint, int, and bigint |
|
|
45 | (1) |
|
|
46 | (1) |
|
|
47 | (1) |
|
|
48 | (1) |
|
|
48 | (1) |
|
|
49 | (1) |
|
|
50 | (1) |
|
5 Joining Database Tables |
|
|
51 | (12) |
|
Selecting Data from Multiple Tables |
|
|
51 | (2) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
54 | (1) |
|
|
55 | (1) |
|
|
56 | (1) |
|
|
56 | (1) |
|
|
57 | (2) |
|
Variations on Join Syntax |
|
|
59 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
60 | (1) |
|
Joining Tables in Different Databases |
|
|
61 | (1) |
|
|
62 | (1) |
|
6 Performing Complex Joins With Multiple Tables |
|
|
63 | (22) |
|
Writing One Query with Two Join Types |
|
|
63 | (3) |
|
|
66 | (2) |
|
|
68 | (1) |
|
Managing the Data in Your Result Set |
|
|
69 | (1) |
|
|
70 | (1) |
|
|
70 | (2) |
|
|
72 | (3) |
|
|
75 | (1) |
|
Recursive Common Table Expressions |
|
|
76 | (2) |
|
|
78 | (1) |
|
|
78 | (1) |
|
Subqueries That Return More Than One Row |
|
|
79 | (2) |
|
|
81 | (2) |
|
|
83 | (2) |
|
|
85 | (14) |
|
|
85 | (1) |
|
|
86 | (1) |
|
|
87 | (1) |
|
|
88 | (1) |
|
|
88 | (1) |
|
|
88 | (1) |
|
|
89 | |
|
|
39 | (50) |
|
|
89 | (1) |
|
|
90 | (1) |
|
|
90 | (1) |
|
|
91 | (1) |
|
|
91 | (1) |
|
|
91 | (2) |
|
|
93 | (1) |
|
|
94 | (1) |
|
|
95 | (1) |
|
|
95 | (3) |
|
|
98 | (1) |
|
8 Calling Built-In Mysql Functions |
|
|
99 | (44) |
|
|
100 | (1) |
|
Passing Arguments to a Function |
|
|
100 | (1) |
|
|
101 | (2) |
|
Calling Functions Within Functions |
|
|
103 | (1) |
|
Calling Functions from Different Parts of Your Query |
|
|
104 | (1) |
|
|
105 | (1) |
|
|
105 | (1) |
|
|
106 | (1) |
|
|
107 | (1) |
|
|
107 | (1) |
|
|
107 | (2) |
|
|
109 | (3) |
|
|
112 | (1) |
|
|
112 | (1) |
|
|
113 | (1) |
|
|
114 | (1) |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
116 | (2) |
|
|
118 | (1) |
|
|
119 | (1) |
|
|
119 | (1) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
123 | (1) |
|
|
124 | (1) |
|
|
125 | (1) |
|
Mathematical Operators and Functions |
|
|
125 | (1) |
|
|
126 | (2) |
|
|
128 | (7) |
|
|
135 | (1) |
|
|
135 | (1) |
|
|
136 | (1) |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
138 | (2) |
|
|
140 | (1) |
|
|
141 | (2) |
|
9 Inserting, Updating, And Deleting Data |
|
|
143 | (14) |
|
|
143 | (1) |
|
|
144 | (2) |
|
Inserting Multiple Rows at Once |
|
|
146 | (1) |
|
Inserting Without Listing Column Names |
|
|
147 | (1) |
|
Inserting Sequences of Numbers |
|
|
147 | (2) |
|
Inserting Data Using a Query |
|
|
149 | (2) |
|
Using a Query to Create and Populate a New Table |
|
|
151 | (1) |
|
|
152 | (1) |
|
|
153 | (1) |
|
Updating Multiple Columns |
|
|
153 | (1) |
|
|
154 | (1) |
|
Truncating and Dropping a Table |
|
|
155 | (1) |
|
|
156 | (1) |
|
PART III DATABASE OBJECTS |
|
|
157 | (60) |
|
|
159 | (6) |
|
|
159 | (2) |
|
Using Views to Hide Column Values |
|
|
161 | (2) |
|
Inserting, Updating, and Deleting from Views |
|
|
163 | (1) |
|
|
163 | (1) |
|
|
164 | (1) |
|
|
164 | (1) |
|
11 Creating Functions And Procedures |
|
|
165 | (30) |
|
|
165 | (2) |
|
|
167 | (1) |
|
|
168 | (2) |
|
Adding Parameters and Returning a Value |
|
|
170 | (1) |
|
Specifying Characteristics |
|
|
171 | (1) |
|
Defining the Function Body |
|
|
172 | (1) |
|
|
173 | (2) |
|
Using select to Display Values |
|
|
175 | (1) |
|
Defining Local Variables and User Variables |
|
|
176 | (2) |
|
Using Logic in Procedures |
|
|
178 | (6) |
|
Displaying Procedure Results with select |
|
|
184 | (2) |
|
|
186 | (4) |
|
Declaring Output Parameters |
|
|
190 | (1) |
|
Writing Procedures That Call Other Procedures |
|
|
191 | (1) |
|
Listing the Stored Routines in a Database |
|
|
192 | (1) |
|
|
193 | (2) |
|
|
195 | (14) |
|
|
195 | (1) |
|
|
196 | (3) |
|
|
199 | (1) |
|
|
200 | (2) |
|
Triggers That Affect Data |
|
|
202 | (1) |
|
|
203 | (1) |
|
|
204 | (2) |
|
|
206 | (1) |
|
|
207 | (2) |
|
|
209 | (8) |
|
|
210 | (1) |
|
Creating Events with No End Date |
|
|
210 | (2) |
|
Creating Events with an End Date |
|
|
212 | (1) |
|
|
213 | (2) |
|
|
215 | (2) |
|
|
217 | (42) |
|
|
219 | (18) |
|
|
219 | (1) |
|
Working in the Wrong Database |
|
|
220 | (2) |
|
|
222 | (1) |
|
Leaving where Clauses Incomplete |
|
|
223 | (2) |
|
Running Partial SQL Statements |
|
|
225 | (1) |
|
|
226 | (2) |
|
Supporting an Existing System |
|
|
228 | (2) |
|
Using the MySQL Command Line Client |
|
|
230 | (2) |
|
|
232 | (2) |
|
|
234 | (1) |
|
|
235 | (1) |
|
|
236 | (1) |
|
15 Calling Mysql From Programming Languages |
|
|
237 | (22) |
|
|
238 | (1) |
|
|
239 | (4) |
|
|
243 | (3) |
|
|
246 | (4) |
|
|
250 | (1) |
|
|
251 | (1) |
|
Inserting a Row into a Table |
|
|
252 | (1) |
|
Calling a Stored Procedure |
|
|
253 | (1) |
|
|
253 | (1) |
|
|
254 | (1) |
|
Inserting a Row into a Table |
|
|
255 | (1) |
|
Calling a Stored Procedure |
|
|
256 | (1) |
|
|
257 | (2) |
|
|
259 | (54) |
|
16 BUILDING A WEATHER DATABASE |
|
|
261 | (16) |
|
|
262 | (1) |
|
|
262 | (1) |
|
|
263 | (1) |
|
|
263 | (1) |
|
|
264 | (1) |
|
|
265 | (1) |
|
Creating the Weather Tables |
|
|
266 | (1) |
|
|
267 | (1) |
|
|
268 | (1) |
|
|
269 | (2) |
|
Copying the Data to Your Final Table |
|
|
271 | (3) |
|
Scheduling the Bash Script on cron |
|
|
274 | (1) |
|
|
275 | (1) |
|
|
276 | (1) |
|
17 Tracking Changes To Voter Data With Triggers |
|
|
277 | (24) |
|
|
278 | (1) |
|
|
278 | (1) |
|
|
279 | (1) |
|
|
280 | (1) |
|
|
281 | (1) |
|
|
281 | (1) |
|
The ballot_candidate Table |
|
|
282 | (1) |
|
|
283 | (1) |
|
|
284 | (6) |
|
|
290 | (9) |
|
|
299 | (1) |
|
|
299 | (1) |
|
|
299 | (1) |
|
Replacing check Constraints with New Tables |
|
|
299 | (1) |
|
|
300 | (1) |
|
18 Protecting Salary Data With Views |
|
|
301 | (12) |
|
Creating the employee Table |
|
|
301 | (2) |
|
|
303 | (1) |
|
|
303 | (1) |
|
Using MySQL Workbench to Test User Access |
|
|
304 | (6) |
|
|
310 | (1) |
|
|
311 | (2) |
Afterword |
|
313 | (2) |
Index |
|
315 | |