MySQLby Paul DuBois
With over 11 million installations, MySQL is the most widely used open source database management system worldwide. Many of the world's largest and fastest-growing organizations use MySQL to power high-volume Web sites, business-critical systems and packaged software -- including industry leaders such as Yahoo, Google, The Associated Press, Suzuki, and NASA. MySQL 5.1 is a significant new version of the database that further brings MySQL up to the level of an enterprise-class database system. In MySQL, Paul DuBois provides a comprehensive guide to using MySQL effectively and productively. He describes everything from the basics, to using MySQL to generate dynamic Web pages, to administering MySQL servers. The fourth edition of this bestseller has been reviewed by top developers in the MySQL community and incorporates feedback from readers and top MySQL developers. With detailed coverage of new features and improvements in MySQL 5.1, this is the most comprehensive and thorough edition to date. This new edition includes extended coverage of stored programs -- stored procedures, functions and triggers; coverage of a new type of stored program -- events; a completely new chapter on "Stored Programs"; completely rewritten PHP chapter and appendix.
Read an Excerpt
Chapter 1: Introduction to MySQL and SQLThis chapter provides an introduction to the MySQL relational database management system (RDBMS), and to the Structured Query Language (SQL) that MySQL understands. It lays out basic terms and concepts you should understand, describes the sample database we'll be using for examples throughout the book, and provides a tutorial that shows you how to use MySQL to create a database and interact with it.
Begin here if you are new to databases and perhaps uncertain whether or not you need one or can use one.You should also read the chapter if you don't know anything about MySQL or SQL and need an introductory guide to get started. Readers who have experience with MySQL or with database systems might want to skim through the material. However, everybody should read the section "A Sample Database" because it's best if you're familiar with the purpose and contents of the database that we'll be using repeatedly throughout the book.
How MySQL Can Help You
This section describes situations in which the MySQL database system is useful. This will give you an idea of the kinds of things MySQL can do and the ways in which it can help you. If you don't need to be convinced about the usefulness of a database system-perhaps because you've already got a problem in mind and just want to find out how to put MySQL to work helping you solve it-you can proceed to "A Sample Database."
A database system is essentially just a way to manage lists of information. The information can come from a variety of sources. For example, it can represent research data, business records, customer requests, sports statistics, sales reports, personal hobby information, personnel records, bug reports, or student grades. However, although database systems can deal with a wide range of information, you don't use such a system for its own sake. If a job is easy to do already, there's no reason to drag a database into it just to use one. A grocery list is a good example:You write down the items to get, cross them off as you do your shopping, and then throw the list away. It's highly unlikely that you'd use a database for this. Even if you have a palmtop computer, you'd probably use its notepad function for a grocery list, not its database capabilities.
The power of a database system comes in when the information you want to organize and manage becomes voluminous or complex so that your records become more burdensome than you care to deal with by hand. Databases can be used by large corporations processing millions of transactions a day, of course. But even small-scale operations involving a single person maintaining information of personal interest may require a database. It's not difficult to think of situations in which the use of a database can be beneficial because you needn't have huge amounts of information before that information becomes difficult to manage. Consider the following situations:
- Your carpentry business has several employees.You need to maintain employee and payroll records so that you know who you've paid and when, and you must summarize those records so that you can report earnings statements to the government for tax purposes. You also need to keep track of the jobs your company has been hired to do and which employees you've scheduled to work on each job.
- You run a network of automobile parts warehouses and need to be able to tell which ones have any given part in their inventory so that you can fill customer orders.
- As a toy seller, you're particularly subject to fad-dependent demand for items that you carry.You want to know what the current sales trajectory is for certain items so that you can estimate whether to increase inventory (for an item that's becoming more popular) or decrease it (so you're not stuck with a lot of stock for something that's no longer selling well).
- That pile of research data you've been collecting over the course of many years needs to be analyzed for publication, lest the dictum "publish or perish" become the epitaph for your career.You want to boil down large amounts of raw data to generate summary information, and to pull out selected subsets of observations for more detailed statistical analysis.
- You're a popular speaker who travels the country to many types of assemblies, such as graduations, business meetings, civic organizations, and political conventions.You give so many addresses that it's difficult to remember what you've spoken on at each place you've been, so you'd like to maintain records of your past talks and use them to help you plan future engagements. If you return to a place at which you've spoken before, you don't want to give a talk similar to one you've already delivered there, and a record of each place you've been would help you avoid repeats.You'd also like to note how wen your talks are received. (Your address "Why I Love Cats" to the Metropolitan Kennel Club was something of a dud, and you don't want to make that mistake again the next time you're there.)
- You're a teacher who needs to keep track of grades and attendance. Each time you give a quiz or a test, you record every student's grade. It's easy enough to write down scores in a gradebook, but using the scores later is a tedious chore. You'd rather avoid sorting the scores for each test to determine the grading curve, and you'd really rather not add up each student's scores when you determine final grades at the end of the grading period. Counting each student's absences is no fun, either.
- The organization for which you are the secretary maintains a directory of members. (The organization could be anything-a professional society, a club, a repertory company, a symphony orchestra, or an athletic booster club.) You generate the directory in printed form each year for members, based on a word processor document that you edit as membership information changes.
You're tired of maintaining the directory that way because it limits what you can do with it. It's difficult to sort the entries in different ways, and you can't easily select just certain parts of each entry (such as a list consisting only of names and phone numbers). Nor can you easily find a subset of members, such as those who need to renew their memberships soon-if you could, it would eliminate the job of looking through the entries each month to find those members who need to be sent renewal notices.
Also, you'd really like to avoid doing all the directory editing yourself, but the society doesn't have much of a budget, and hiring someone is out of the question.You've heard about the "paperless office" that's supposed to result from electronic record-keeping, but you haven't seen any benefit from it. The membership records are electronic, but, ironically, aren't in a form that can be used easily for anything except generating paper by printing the directory!
These scenarios range from situations involving large amounts to relatively small amounts of information. They share the common characteristic of involving tasks that can be performed manually but that could be performed more efficiently by a database system.
What specific benefits should you expect to see from using a database system such as MySQL? It depends on your particular needs and requirements-and as seen in the...
Meet the Author
Paul DuBois is a network and database administrator at the University of Wisconsin-Madison. He has published technical documentation in the computer field and is a contributor to the MySQL Reference Manual.
and post it to your social network
Most Helpful Customer Reviews
See all customer reviews >
I bought this based on the recommendations here and elsewhere. I have to give Mysql 5 stars because it's a really excellent book. However I really like to hear about potential downsides in otherwise great deals (nothing's perfect), so here's the problems I had: The way they did examples may be by design in order to force the reader (especially a newbie like me) to experiment, but I thought the examples were thin. There do not seem to be many hints on how to handle real-world problems. I usually have to experiment a lot to figure out how something works. I also cannot seem to adjust to either the contents or the index as written, and I have trouble finding references to particular topics. One suggestion is to get some adhesive tab labels and attach them the pertinent pages marking the sections you find helpful. Write your own keyword descriptions on the labels so you don't waste time looking through the whole book for that one topic you remember seeing last week :)
As a newcomer to Mysql, the task of setting up and administrating a database seemed overwhelming. This book has detailed every step along the way, from installing and starting the Mysql server on different platforms (I use linux and Windows), to managing security, to designing web-based interfaces. It does not cover preliminary design considerations such as determining who is going to use the database and for what purposes, or, how one creates tables in third normal form. Other books can be used to cover these more general topics. It does give step by step instructions using two sets of examples throughout the book. It is easy to follow without being tedious. If you are trying to choose between this book and 'Mysql and msql', choose this one. I have both and this does a much better job in explaining the specifics of Mysql.
From table creation to API usage this book gave me the perfect informations needed to get to speed with MySQL. Everything you need is in this book and very well organized. Bravo !
MySQL is clear and easy to read ¿ it is intended to * teach * you MySQL, and it does just that. If you¿re looking for a great book about MySQL, this is it.
On a scale of 10, this book gets a 10 from me. Everything I needed to do a new MYSQL project was in this book. Like my old Perl4 book - Perl in 21 Days - this one has it all. It is extremely well written and organized. If you are a part-time Perl-DB programmer (or dabble infrequently at it), this book can get you through the job w/o alot of problems. Lastly, I used DBI::mysql to interface, and this book covered the topic very well.
Paul Dubois is one of those rare authors who truely cares about the work. MySQL is written in a clear consise and humorous manner. I paid $50.00 for this book and would gladly pay double that. I will buy his next book sight unseen for $100.00
I've read quite a few books on MySQL, this one definitely tops them in just about every way. Covering the API's thoroughly, and just being an all around excellent book