First, let’s get this one thing out of the way. How do you pronounce “SQL.”
Donald Chamberlin, the co-developer of SQL, pronounces it by saying the letter out louse. Ess Cue Ell. However, many computer science teachers prefer “sequel” and in at least one poll, the latte won out. One of the most common implementations of the database language is mySQL, and that piece of software is officially pronounced “My Ess Cue Ell” and not “Mysequel.”
I myself have never once uttered the word “sequel” when referring to this database system. I have also never once uttered either the term “Jiff” or “Giff” in relation to *.gif files. They are, to me, “Gee Eye Eff” files. I admit, however, to calling *.jpg files “Jay pegs” even when they are not *.jpeg.
But I digress. We are here to talk about a new book, on SQL.
The book is Practical SQL: A Beginner’s Guide to Storytelling with Data by the award winning journalist Anthony DeBarros. DeBarros is as much of a writer as he is a database geek, which gives this book a pleasant twist.
The book provides what you need to know to create databases and set up relationships. But don’t get excited, this is not a dating book.
See, a “database” isn’t really a thing, but a collection of things. Normally, at the root of a database is a set of tables, which look like squared off sections of spreadsheets, or highly organized lists, if you lay them out. But then, the different fields (columns) of the tables are related to each other. This is important. Let’s say you have a table of individuals in your club, and each individual has a set of skills they bring to the table. It is a model railroad club, so you’ve got engineers, artificial vegetation experts, landscape sculptors, background and sky painters, and so on. Also, each club member has a known set of days of the week and hours that they are available to meet or to manage some event you are having. Plus, they each have lunch food and drinks preferences for when you order out. Three of the members drive wheelchairs. And so on.
You have a table of dates and times that will be when your club will meet over the next year. You have a list of venues you will meet in. Each venue is associated with a different deli where you order out. Some of the venues are not wheelchair friendly, while some are.
Imagine putting together a big chart that shows all the events, who is going to them, what everyone will eat, what everyone will do, and special needs requirements, for the next ten years.
If that was one single giant structured table, each time a given member was included on a sublist because he or she, there would also be all the information about the person’s address, phone number, email, food preference, skill, etc. etc.
So you don’t do that. Instead, the database is taught to associate the name of each member with that member’s personal file, including all that personal information, in a way that lets you selective ignore or include that information. Then, the database lets you construct new, novel, virtual tables that combine the information in a clever way.
For instance, for an upcoming event, you can have a to-do list that includes which materials to order for a build of a new model, and whether or not the person who helps Joe with the wheelchair thing should be sent a note to remind him to definitely come, and a precise list to send to the corner deli, as well as the phone number of the deli, for lunch, and so on.
Tables, linked together with relationships, which are then mined to make these novel tables which are called queries.
You may need to import data, export data, clean up errors, you may be using a GIS system, creating automatic emails or mail merge documents, and at some point you might even want to analyze the data.
Practical SQL: A Beginner’s Guide to Storytelling with Data tells you all the stuff you need to do in order to carry out these tasks. As is the usual case with No Starch Press books, the code that is used in the book is downloadable.
The book assumes you are using PostgreSQL, which is free (and there are instructions to get it) but all SQL systems are very similar, so that really doesn’t matter too much.
Everybody who works with data should know some SQL. All desktop operating systems (Linux, MacOS, Windows) use this sort of software and it runs about the same way on all of them. Just so you know, you are using SQL now reading this blog, because SQL or something like it lies at the base of pretty much every common way of serving up web pages. Prior to you clicking on the link, these very words were in a database file, along with the name of the post, a link to the graphic used, etc. etc. A bit of PHP code accessed the data from the SQL database and rendered it into HTML, which was then fed to your browser. SQL is one of those things that lies at the root of how we communicate on line, and the basics of how it works and what you can do with it have not changed in a long time. The first relational models go back to 1970. Remember “dbase”? That was an early version, deployed in the early 1980s. By the mid 1980s, everything you can do with modern SQL, to speak of, was implemented.
Enjoy and learn from Practical SQL: A Beginner’s Guide to Storytelling with Data.