Alex holding a Cool Water Kong.  Harvard Yard.

Preface

to SQL for Web Nerds by Philip Greenspun

Dublin, Ireland. The last thing the world needs is another SQL tutorial. So here's ours ...

We could wallpaper all 500 rooms of the computer science building at MIT with different SQL tutorials from various publishers. Yet when it came time to sit down with our students and teach them this material, we couldn't bear to use any of the commercial texts.

The CS department at MIT doesn't offer a course in SQL (or in any other computer language per se for that matter). But lots of universities do and therefore you can choose from many textbooks designed to teach SQL to 20-year-old CS majors. Perfect, eh? Not for us. Part of the problem is that universities try to give students what they deem to be eternal knowledge. So rather than focus on the relational model and SQL, the overwhelmingly dominant system for the past 20 years, introductory database textbooks spend several chapters talking about database management systems that were used in the 1960s.

The second part of the problem with college-level texts is that these books are too dreary and long. In our class, the students face the tangible problem of building a sophisticated db-backed Web service in 12 weeks. This motivates them to learn whatever intricacies of SQL that they need. But what keeps a student going through 500 pages of SQL and RDBMS? We can't figure this out.

The third problem is that most of the college-level textbooks bring to mind the old question "What is the difference between a tenured professor of computer science and an ape?" (The ape doesn't think he can program.) Sure, the academic egghead author can learn the syntax of SQL but he or she won't have any personal experience with real-life interesting systems. That's because no real user of the RDBMS is stupid enough to hire a professor to write any SQL code.

In our computer-obsessed society, we need not be stuck with the dry theoretical offerings of computer scientists. Walk into any bookstore and you'll find SQL tutorials. Sadly, due to structural problems in the trade computer book industry (see http://philip.greenspun.com/wtr/dead-trees/story), most of these books are written by authors who picked up SQL as they were writing. There are some good ones, however, our favorite being The Practical SQL Handbook (Bowman, Emerson, Darnovsky; Addison-Wesley). We truly do like this book so we can feel free to pick on it:

Bashing other authors and publishers is fun but isn't pedagogically effective. Thus it is probably worth stating what this SQL tutorial tries to do.

First and foremost, we keep our readers in the world of Web services. Most often they are working within the data model for online communities chronicled in Philip and Alex's Guide to Web Publishing. Sometimes we drag readers into the dreary world of commerce but at least it is the flashier-than-average corner of ecommerce.

Second, our examples are all drawn from real production Web sites that get close to 1 million requests per day. This should make the examples more interesting, particularly as the sites are mostly still up and running so the students will be able to visit pages and see the queries in action on up-to-the-minute data sets.

Third, we assume that our readers are bright and accustomed to formal languages. We don't assume any experience with declarative languages, database query languages, or any specific programming language. But once we can assume that the reader has written code, it is possible to use more sophisticated examples and get to the interesting stuff more quickly. So if this book ends up being a bad choice for the office manager who wants to start building marketing reports, we hope that we make up for it by making it a great choice for the MIT student or the working programmer.

Fourth, we assume that our readers will be using Oracle. This is a safe assumption for our class because we set up the computing facility and, in fact, Oracle8 is the only RDBMS running on it! It is also a safe assumption for much of the world: Oracle is the most popular RDBMS system available. We find it burdensome to maintain. We wish it were open-source. We wish it were free. Yet if we accept Oracle as part of the landscape, we don't have to waste a lot of ink pretending that SQL is a standard.



Next: introduction/overview


philg@mit.edu
Add a comment