Wasn’t sure what I was expecting, but this isn’t it… whew

The book above arrived at my apartment via Amazon the middle of last week. I made the decision to learn stored procedures as a way to expand my skill base and hopefully reduce some of the load we place on our SQL server at IDX by writing more efficient queries. I was expecting a book that was a couple hundred pages long describing some method of chaining statements or doing caching or… I don’t really know. What I got was a 600 page book that describes a fully realized ANSI standard coding language that loosely resembles Pascal.
My surprise does not equate to disappointment. The new possibilities that stored procedures open up to me are huge and I’m eager to explore them. I started using MySQL back when it was somewhere in its version 3 life span. Back then all I was after was something easier to work with than files for storing data. I had just recently started coding in PHP and was frustrated by how much more difficult it was to work with files in PHP 3 than it was in Perl 5. It’s only been in the last 18 months that I’ve really gotten in to MySQL and all it has to offer. As such I didn’t really know much of anything about procedures despite the fact that other DB systems have had them for years.
As it turns out there are actually 3 types of programs that make up MySQL procedures. The first it the “procedure” which is a full procedural program including control statements and loops. The second type is the “function” which, once written, can be used in any SQL statement to increase mysql’s functionality. The third type is the trigger which is code that will automatically fire when every a specific event occurs.
If you have any interest in learning procedures I’d recommend it. The time spent learning will be valuable. I am coming to realize that SQL is the most interesting part of application development for me. Relational databases are more powerful than I imagined back when I first started using them. Good SQL is the key to robust applications.