Head First SQL (Book Review)
Posted by Steve Farwell at 4:08 PM
17 comments - Categories:
Book Reviews
Head First SQL
SQL is one of the basic tools that every web developer needs in his or her tool box. If you are a developer that learned HTML and picked up ColdFusion as the natural step into dynamic web development, SQL may have been new to you. So you learned how to grab sets of data with "select * from artists" and maybe fine tuned it with "where artist_id = 3". Soon you found that you could loop through the data set using CFOUTPUT or CFLOOP and conditionally displayed information or reformatted the data using CFIF or a number of ColdFusion functions. Continuing to explore ColdFusion's cool tags and functions you start creating arrays, structures, queries of queries and even dabble with CFSCRIPT, ColdFusion Components and user defined functions. This is all so cool....but your pages are dead slow and your code looks like all-you-can-eat night at Ye Olde Spaghetti Factory. At this point you remember hearing that you should let SQL do what it does best, manipulate data, and let ColdFusion do what it does best, present data.
That's Head First SQL comes in. It will take you from the basics of SQL that you learned from a ColdFusion developer's book to a point where you can separate out just about all of the data manipulation and let ColdFusion display that nicely crafted data set. Head First SQL assumes you have no SQL knowledge so you can rush through the first couple chapters being careful to catch a few tips and tidbits as flip through those pages. The first couple chapters will cover things to consider in table creations and how to get data into and out of the table. The book does a nice job of covering SELECT enhancements using the qualifiers like BETWEEN, LIKE, IN, IS NULL to help you bring back just the data you need.
One of the most important concepts in database design is normalization. Normalization is organizing your database so that you have a minimal amount of redundant data. A simple example is having a table of customer information with a unique ID assigned to each customer and only that ID is stored with each order from that customer. This reduces the amount of data stored and also improves accuracy and maintenance as a change of address would mean one customer record change rather than changing many order changes. Head First SQL covers this well and of course does it in a fun fashion, come on the chapter is titled "Why be normal?". Primary keys and foreign keys, the data that relates one tables data to another, are clearly explained and emphasized.
After expanding our minds into good database design with normalization, they need to do some mind expansion to help us get that data back out. Withmultiple related tables we need to do JOINS, INNER JOINS, and OUTER JOINS to pull it all back together. There is also a concept of sub queries which helps us get our minds around bringing back a data set by first bringing back a general data set and querying that again to get a presentable data set.
The book has a nice set of extras at the end and overall it presents a critical topic for web developers in a fun way. If SQL is something you may need to see some documentation or a few examples to get the concept or get through a step in a project, this book might not be the best reference manual for you. If SQL or other areas are hard for you to get your head around, the Head First Series is definitely worth your consideration. And hey, it's O'Reilly so you won't feel like A Complete Idiot or a For Dummies kind of person when you are having some fun learning. Once you get through this book you can look to O'Reilly for books to learn about SWITCH/CASE, triggers, stored procedures, and all the stuff you need to know to keep your DBA in line.
Tom Barr
dinoYT wrote on 05/15/09 12:08 AM
To me the benefit for us CFML developers is in the greater adoption (and the attendant increase in numbers of developers using the language) that Railo and OpenBD can bring to CFML as a language and community. For Adobe — http://rapid4me.com/?q=Adobe, I think the profit lies in Bolt (or whatever it will be called). Assuming a greater number of CF users (sites, developers, etc.), the need for a standard IDE increases (no knock on CFEclipse...I love and use it daily). I, personally, think this is where Adobe sees the dollars (see the opening of Flex as a server versus the incredible sales of Flex Builder since version 2 as a model).