Many of you are still working with earlier versions of the MySQL database. This article takes a look at MySQL 4.1. It is the first of several parts that examine more recent versions of the software. It is excerpted from chapter eight of Beginning MySQL Database Design and Optimization: From Novice to Professional, written by Jon Stephens and Chad Russell (Apress, ISBN: 1590593324).
MYSQL IS CONSTANTLY EVOLVING, AND THANKS to the Open Source paradigm of “Release early and often,” improvements can be seen in nearly every single release. As with most software, however, significant changes and additions most often occur in major releases.
As we write, MySQL 4.1 has reached "gamma" status with the recent release of version 4.1.4, and a production version is very likely to be available not long after this book has gone to press. While there are other features worth mentioning—and we will mention them!—we’ll focus primarily on subqueries (queries within queries), their different types, and the ways in which they can be used.
5.0-alpha versions of MySQL have been available for testing and feedback since the beginning of 2004. In this chapter, we’ll discuss what will become available in these upcoming versions of MySQL, including a detailed look at what may be the most eagerly anticipated new feature of all in the 5.0.X series: stored procedures and stored functions. These will provide a way to store, combine, and reuse oft-repeated queries and pieces of SQL logic and functionality, and thereby promise great advances for database developers and administrators in terms of both efficiency and security for MySQL and the applications that use it. We’ll also devote a good deal of space to views, which have been implemented in MySQL 5.0.1. Views provide a means of abstracting sets of data derived by complex queries and making them available in much simpler tabular form. As we’ll see, views will have a positive impact on usability and security for MySQL database administrators and developers.
We’ll also discuss what you’re likely to be seeing in MySQL 5.1 when it becomes available. Triggers are another frequent entry on MySQL users’ wish lists, as are views. An implementation of triggers in MySQL will allow you to set stored procedures to be triggered automatically (hence the term “trigger”) when certain events take place within a database. We’ll also try to provide some ideas as to what triggers will be like when they’re implemented.