Gift Guide


MySQL is packed with capabilities, particularly after the major additions in the 5.0 and 5.1 versions. The odds that you will remember a particular function or statement at the right moment are pretty slim. That's why MySQL in a Nutshell, Second Edition, is so valuable. This conveniently organized reference helps you find the details you need quickly, whether it's an SQL keyword, a mysql client command-line option, specific API information, or an administrative utility.

This new...

See more details below
MySQL in a Nutshell

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$15.49 price
(Save 44%)$27.99 List Price


MySQL is packed with capabilities, particularly after the major additions in the 5.0 and 5.1 versions. The odds that you will remember a particular function or statement at the right moment are pretty slim. That's why MySQL in a Nutshell, Second Edition, is so valuable. This conveniently organized reference helps you find the details you need quickly, whether it's an SQL keyword, a mysql client command-line option, specific API information, or an administrative utility.

This new edition contains all the commands and programming information for version 5.1 of MySQL, including new features and language interfaces, plus usage examples for nearly every statement and function listed.

Like all O'Reilly Nutshell references, this book is easy to use and highly authoritative. Inside, you'll find: A thorough reference to MySQL statements, functions, configuration options, and utilities, Several tutorial chapters to help newcomers get started, Programming language APIs for PHP, Perl, and C, Brief tutorials at the beginning of each API chapter, New chapters on replication, triggers, and stored procedures, Plenty of new examples that show how MySQL is used in practice, Tips to help you get through the most difficult subjects.

Whether you employ MySQL in a mission-critical, heavy-use environment or for more modest applications, this book puts a wealth of information at your fingertips, saving you countless hours of trial and error and tedious online searching. If you're ready to take advantage of all MySQL has to offer, MySQL in a Nutshell, Second Edition, is precisely what you need.

About the Author:
Russell Dyer, a freelance writer who specializes in MySQL databasesoftware, is the editor of the MySQL Knowledge Base

Read More Show Less

Product Details

  • ISBN-13: 9781449379377
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 4/15/2008
  • Series: In a Nutshell (O'Reilly)
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 566
  • File size: 4 MB

Meet the Author

Russell Dyer is a freelance writer specializing in MySQL database software and is the editor of the MySQL Knowledge Base (​se.html). He is the author of MySQL in a Nutshell ( and has writen articles for several magazines: Dev Zone (a MySQL publication), Linux Journal,, The Perl Journal, Red Hat Magazine, SysAdmin Magazine, Tech Republic, Unix Review, and He has also finished his first novel, "In Search of Kafka". More information on Russell, along with a list of his published articles with links to them, can be found on his web site at

Read More Show Less

Table of Contents


Part I Introduction and Tutorials

1 Introduction to MySQL 3

The Value of MySQL 3

The MySQL Package 4

Licensing 4

Mailing Lists 5

Books and Other Publications 6

2 Installing MySQL 7

Choosing a Distribution 7

Unix Source Distributions 8

Unix Binary Distributions 10

Linux RPM Distributions 11

Macintosh OS X Distributions 12

Novell NetWare Distributions 14

Windows Distributions 15

Postinstallation 16

3 MySQL Basics 19

The mysql Client 19

Creating a Database and Tables 20

Show Me 23

Inserting Data 23

Selecting Data 24

Ordering, Limiting, and Grouping 25

Analyzing and Manipulating Data 27

Changing Data 29

Deleting Data 30

Searching Data 31

Importing Data in Bulk 32

Command-Line Interface 34

Conclusion 35

Part II SQL Statements and Functions

4 Security and User Statements and Functions 39

Statements and Functions 40

SQL Statements in Alphabetical Order 40

Functions in Alphabetical Order 50

5 Database and Table Schema Statements 57

Statements and Clauses in Alphabetical Order 57

6 Data Manipulation Statements and Functions 113

Statements and Functions Grouped by Characteristics 113

Statements and Clauses in Alphabetical Order 114

Functions in Alphabetical Order 152

7 Table and Server Administration Statements and Functions 155

Statements and Clauses in Alphabetical Order 155

Functions in Alphabetical Order 172

8 Replication Statements and Functions 175

Merits of Replication 175

Replication Process 176

The Replication User Account 183

Configuring the Servers 185

Copying Databases and Starting Replication 187

Starting Replication 189

Backups with Replication 190

SQL Statements andFunctions in Alphabetical Order 191

Replication States 198

9 Stored Routines Statements 203

Statements in Alphabetical Order 203

10 Aggregate Clauses, Aggregate Functions, and Subqueries 221

Aggregate Functions in Alphabetical Order 221

Subqueries 229

11 String Functions 235

String Functions Grouped by Type 235

String Functions in Alphabetical Order 236

12 Date and Time Functions 263

Data and Time Functions Grouped by Type 264

Date and Time Functions in Alphabetical Order 264

13 Mathematical Functions 297

Functions in Alphabetical Order 297

14 Flow Control Functions 309

Functions in Alphabetical Order 309

Part III MySQL Server and Client Tools

15 MySQL Server and Client 315

mysql Client 315

mysqld Server 321

mysqldömulti 352

mysqldösafe 354

16 Command-Line Utilities 357

Part IV APIs and Connectors

17 CAPI 405

Using C with MySQL 405

Functions in Alphabetical Order 408

C API Datatypes 435

18 Perl API 437

Using Perl DBI with MySQL 437

Perl DBI Reference 442

Attributes for Handles 470

19 PHP API 477

Using PHP with MySQL 477

PHP MySQL Functions in Alphabetical Order 479

Part V Appendixes

A Data Types 503

B Operators 511

C Server and Environment Variables 517

Index 519

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted May 8, 2005

    you need a background in SQL

    Well the book certainly seems to cover MySQL's features quite comprehensively. But, as it is a reference manual, it does not attempt to teach you MySQL or the theory of relational databases. For a given MySQL command, the book's explanation is succinct and useful. Provided you already have a background in the area. Much of the book's discussion is probably already available in equivalent form in the online help. But hardcopy is nice to have. Going through the functions, what you might appreciate about MySQL is that many of these are generic SQL functions. If you come from any other SQL implementation, your background will be relevant to much of the book.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted June 3, 2005

    Sometimes You Feel Like a

    I have a few `Nutshell¿ books in my library, and have found them to be a source I refer to time and time again. So, when I saw that O¿Reilly had released a `Nutshell¿ book on MySQL, I headed on over to my local bookstore and spent some time in a high-back chair perusing it¿s pages. Don¿t let the size of the book fool you. The information it contains is well laid out into identifiable topics for easy reference. Since I have acquired this book, I have been able to find desired functions, statements and utilities more easily than before. Lately, I am spending a considerable amount of my time tuning and optimizing SQL queries that appear throughout a large PHP application I am designing. I initially wrote the queries months ago, but with my newfound reference in hand, I have been able to significantly reduce the amount of execution time each query takes. One of the book¿s pleasant surprises was the section regarding flow control functions, which lets me take my SQL query functionality far beyond where it ever has been. The book also includes chapters on PERL, PHP and C APIs, which prove to be very readable. This little powerhouse packs a punch. I definitely recommend ¿MySQL in a Nutshell, A Desktop Quick Reference by Russell J.T. Dyer¿ to anyone developing applications that interface with MySQL, or to anyone who wants to get to know MySQL better. -Brett Berry PERL/PHP/JavaScript/MySQL

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)