Today, MySQL is the world’s most popular open-source database, and this book will help you master it. As you would expect, this book shows how to code all of the essential SQL statements for working with a MySQL database. But beyond that, this book shows how to design and implement a database and how to take advantage of relatively new features like foreign keys, transactions, and stored procedures. It even has a section on database administrator (DBA) skills.

College Instructors

I was amazed at how much information was packed into this book. The style of the book made it really easy to read and understand the information.... I learned a lot of new MySQL ideas reading this book, and I will be using it frequently as a reference."

Paul Turpin Southeastern Inter-Relational Database Users Group

About this Book

Table of Contents

FREE Downloads

Book FAQs

Corrections

Reviews

What you’ll learn in this book

Section 1: An introduction to MySQL

In this section, you’ll learn the concepts and terms for working with any database. You’ll learn how to use MySQL Workbench to work with a database and run SQL statements. And you’ll learn the basic SQL skills for retrieving data from a database and for adding, updating, and deleting data. When you complete this section, you’ll be able to continue with any of the other sections in the book.

Section 2: More SQL skills as you need them

This section presents the advanced skills for retrieving data from a database. That includes working with summary queries, subqueries, data types, and functions. These skills are also sure to raise your expertise, even if you already have SQL experience. And you can read these chapters in whatever sequence you prefer.

Section 3: Database design and implementation

In this section, you’ll learn how to use MySQL Workbench to create an EER (enhanced entity-relationship) model for your database. Then, you’ll learn how to implement that design by using the DDL (Data Definition Language) statements that are a part of SQL. When you’re done, you’ll be able to design and implement your own databases, and you’ll have a new perspective on databases that will make you a better SQL programmer, even if you never have to design a database.

Section 4: Stored program development

In this section, you’ll learn how to use MySQL to create stored procedures, functions, triggers, and events. In addition, you’ll learn how to manage transactions and locking. These features let you create stored programs made up of multiple SQL statements that can be stored in the database and accessed as needed, either to run on their own or to use in application programs…a great productivity booster!

Section 5: Database administration

In this section, you’ll learn a starting set of skills for becoming a database administrator (DBA). These skills include how to secure a database, how to back up a database, and how to restore a database.

Who this book is for

Application developers

I think it’s fair to say that most developers don’t know enough about SQL and the database management system they’re using. As one customer put it, "I know just enough about SQL to be a little bit dangerous!"

That’s why developers often code SQL statements that don’t perform as efficiently as they ought to. That’s why they aren’t able to code some of the queries that they need for their applications. And that’s why they don’t take advantage of all the features that MySQL has to offer.

That’s also why our MySQL book should be required reading for every application programmer who uses MySQL. It shows you how to code the SQL statements that you need for your applications. It shows you how to code these statements so they run efficiently. And it shows you how to take advantage of the most useful advanced features that MySQL has to offer.

Anyone who wants to become a database administrator

This book is also the right first book for anyone who wants to become a database administrator. Although this book doesn’t present all of the advanced skills that are needed by a DBA, it will get you started. Once you’ve finished it, you’ll be prepared for more advanced books on the subject.

Anyone who wants to learn standard SQL

This book is also a good choice for anyone who wants to learn standard SQL. Since SQL is a standard language for accessing database data, most of the SQL code in this book will work with any database management system. As a result, once you use this book to learn how to use SQL to work with a MySQL database, you can transfer most of what you have learned to another DBMS such as Oracle, DB2, or Microsoft SQL Server.

What the prerequisites are

Although you will progress through this book more quickly if you have some development experience, everything you need to know about databases and SQL is presented in this book. As a result, you don’t need to have any programming background to use this book.

What software you need

Although you should be able to use this book with most versions of MySQL, we recommend that you use:

MySQL Community Edition 5.6 or higher

MySQL Workbench 6.2 or higher

Both of these products can be downloaded for free from MySQL’s website. And appendixes A (for Windows) and B (for Mac OS X) provide complete instructions for installing them.

Since MySQL is backwards compatible, all of the SQL statements presented in this book should also work with future versions of MySQL. In addition, most statements presented in this book work with earlier versions of MySQL, and we have done our best to identify any statements that don’t.

If you use MySQL Workbench 6.2, all of the skills presented in this book should work exactly as described. However, MySQL Workbench is being actively developed, so its functionality is improving all the time. As a result, you may want to use a later version of MySQL Workbench. If you do, the skills presented in this book may not work exactly as described, but they’ll be similar enough that you shouldn’t have any trouble with them.

What people say about this book

"A very solid book with plenty of breadth and lots of examples. As a developer with almost 10 years of MySQL experience, I still picked up a lot of new detail on things I thought I knew." - David Bolton, C/C++/C# Guide, About.com

"I was amazed at how much information was packed into this book. The style of the book made it really easy to read and understand the information.... I learned a lot of new MySQL ideas reading this book, and I will be using it frequently as a reference." - Paul Turpin Southeastern Inter-Relational Database Users Group

"If you ever want to learn to use MySQL, write SQL queries, create database elements, then this is the book to pick up. Rating: 10 Horseshoes." - Review by Mohamed Sanualla, JavaRanch.com

"I’ve found that many technical books go into laborious details that make them difficult to read, let alone use, but Murach’s MySQL has already proven to be helpful in solving several challenges I’ve encountered on my current MySQL project.... One thing I enjoyed is that it’s well-indexed, and the material itself is concise, with stand-alone, real-world examples.... It’s not theoretical, it’s practical, and presents topics in a friendly style that can be consumed painlessly, a few chapters at a time.” - Posted at an online bookseller

“Beautifully written, and encyclopedic. Concepts are presented on facing pages with explanation on left and examples/visuals on right. I’m constantly referring to it - and find it easy to use as a quick reference.” - Posted at an online bookseller

"I found this to be a great introductory book to MySQL.... The examples make it easy to quickly see the differences between the database system you have been working on and how to do the same thing in MySQL. Because of this book, I know that I could easily transition my skills in developing, managing, and designing an Oracle database application to a MySQL database system." - Eric "Morty" Mortensen, Northeast Ohio Oracle Users Group

Sample chapters

Chapter 2 : How to use MySQL Workbench and other development tools

MySQL Workbench is a graphical user interface that makes it easy to work with MySQL database objects and to build and run SQL statements. This tutorial chapter shows you how to use it.

Chapter 3: How to retrieve data from a single table

This chapter shows you how to use SQL SELECT statements to retrieve data from a single table. Our hope is that this will give you a better idea of how much there is to learn about SQL querying...and how well our MySQL book works.

eMail Sign Up

College Instructors

If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.