Items related to MySQL in a Nutshell 2e: A Desktop Quick Reference (In...

MySQL in a Nutshell 2e: A Desktop Quick Reference (In a Nutshell (O'Reilly)) - Softcover

 
9780596514334: MySQL in a Nutshell 2e: A Desktop Quick Reference (In a Nutshell (O'Reilly))
View all copies of this ISBN edition:
 
 

When you need to find the right SQL keyword or MySQL client command-line option right away, turn to this convenient reference, known for the same speed and flexibility as the system it covers so thoroughly. MySQL is packed with so many capabilities that the odds of remembering a particular function or statement at the right moment are pretty slim. With MySQL in a Nutshell, you get the details you need, day in and day out, in one concise and extremely well organized book.

The new edition contains all the commands and programming information for version 5.1, including new features and language interfaces. It's ideal for anyone using MySQL, from novices who need to get up to speed to advanced users who want a handy reference. Like all O'Reilly Nutshell references, it's easy to use and highly authoritative, written by the editor of the MySQL Knowledge Base at MySQL AB, the creator and owner of MySQL.

Inside, you'll find:

  • A thorough reference to MySQL statements, functions, and administrative 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 to help anyone, regardless of experience level, understand and master unfamiliar territory
  • New chapters on replication, triggers, and stored procedures
  • Plenty of new examples of how MySQL is used in practice
  • Useful tips to help you get through the most difficult subjects
Whether you employ MySQL in a mission-critical, heavy-use environment or for applications that are more modest, this book puts a wealth of easy-to-find information at your fingertips, saving you hundreds of hours of trial and error and tedious online searching. If you're ready to take advantage of everything MySQL has to offer, MySQL in a Nutshell has precisely what it takes.

"synopsis" may belong to another edition of this title.

About the Author:

Russell Dyer is a freelance writer and currently the CurriculumManager at MariaDB Ab. He worked previously for six years at MySQL Ab. as their Knowledge Base Editor. He is the author of MySQL in a Nutshell (http://www.oreilly.com/catalog/mysqlian/) and has writen articles for several magazines: Dev Zone (a MySQL publication), Linux Journal, ONlamp.com, The Perl Journal, Red Hat Magazine, SysAdmin Magazine, Tech Republic, Unix Review, and XML.com. 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 http://russell.dyerhouse.com

Excerpt. © Reprinted by permission. All rights reserved.:
Chapter 6 Date and Time Functions

The ability to record dates and times in a MySQL database is a very common requirement. This chapter presents the date and time functions for MySQL.

Date and time data comprises only numeric strings, so it can be stored in a regular character column. However, by using temporal datatype columns, you can use several built-in functions offered by MySQL. Currently, five temporal datatypes are available: date, time, datetime, timestamp, and year. The date column type is only for recording the date and uses the format yyyy-mm-dd. The time column type is for recording time in the format hhh:mm:ss. To record a combination of date and time, you can use the datetime column type: yyyy-mm-dd hh:mm:ss. The timestamp column is similar to datetime, but is a little limited in its range of allowable time: it starts at the Unix epoch time (i.e., 1970-01-01) and ends at the end of 2037. Finally, the year datatype is used only for recording the year in a column.

Incidentally, any function that calls for a date or a time datatype will also accept a combined datetime datatype. For more information on date and time datatypes, see Appendix A.

Validation of date strings is limited: MySQL makes sure that months range only from 0 to 12, and days range from 0 to 31. Therefore, a date such as February 30would be accepted. Version 5.0.2 of MySQL will offer more refined validation that would reject such a date.

At the end of this introduction is a listing of date and time functions, grouped by type of function. The bulk of this chapter consists of an alphabetical listing of date and time functions, with explanations of each. Many functions come with examples, along with a resulting display. For help in locating functions, see the index at the back of this book.

For the examples in this chapter, I used the scenario of a professional services firm (e.g., a law firm or an investment advisory firm) that tracks appointments and seminars in MySQL.

Date and Time Functions Grouped by Type

This section lists the functions according to their purpose: to retrieve a time, extract an element of one, or perform calculations on it.

Determining the Date and Time
CURDATE( ), CURRENT_DATE, CURTIME( ), CURRENT_TIME, CURRENT_TIMESTAMP, NOW( ),LOCALTIME( ), LOCALTIMESTAMP( ), SYSDATE( ), UNIX_TIMESTAMP( ), UTC_DATE( ), UTC_TIME( ), UTC_TIMESTAMP( )

Extracting and Formatting the Date and Time
DATE( ), DATE_FORMAT( ), DAY( ), DAYNAME( ), DAYOFMONTH( ), DAYOFWEEK( ), DAYOFYEAR( ), EXTRACT( ), GET_FORMAT( ), HOUR( ), LAST_DAY( ), MAKEDATE( ), MAKETIME( ), MINUTE( ), MONTH( ), MONTHNAME( ), QUARTER( ), SECOND( ), STR_TO_DATE( ), TIME_FORMAT( ), TIMESTAMP( ), WEEK( ), WEEKDAY( ), WEEKOFYEAR( ), YEAR( ), YEARWEEK( )

Calculating and Modifying the Date and Time
ADDDATE( ), ADDTIME( ), CONVERT_TZ( ), DATE_ADD( ), DATE_SUB( ), DATEDIFF( ), FROM_DAYS( ), FROM_UNIXTIME( ), PERIOD_ADD( ), PERIOD_DIFF( ), SEC_TO_TIME( ), SUBDATE( ), SUBTIME( ), TIME_TO_SEC( ), TO_DAYS( ), TIMEDIFF( ), TIMESTAMPADD( ), TIMESTAMPDIFF( )

Date and Time Functions in Alphabetical Order

The rest of the chapter lists each function in alphabetical order.

ADDDATE( )
ADDDATE(date,INTERVAL value type)

This function adds the given interval of time to the date or time provided. This is an alias for DATE_ADD( ); see its definition for details and interval types.

UPDATE seminars
SET seminar_date = ADDDATE(seminar_date, INTERVAL 7 DAY)
WHERE seminar_date = '2004-12-15'';

This example postpones the seminar that was scheduled for December 15, 2004 to December 22—seven days later. As of Version 4.1 of MySQL, for adding days the second argument of the function may simply be the number of days (i.e., just 7 instead of INTERVAL 7 DAY).

"About this title" may belong to another edition of this title.

  • PublisherO′Reilly
  • Publication date2008
  • ISBN 10 0596514336
  • ISBN 13 9780596514334
  • BindingPaperback
  • Edition number2
  • Number of pages564
  • Rating

Top Search Results from the AbeBooks Marketplace

Seller Image

Dyer, Russell J. T.
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Soft Cover Quantity: 1
Seller:
booksXpress
(Bayonne, NJ, U.S.A.)

Book Description Soft Cover. Condition: new. Seller Inventory # 9780596514334

More information about this seller | Contact seller

Buy New
£ 20.94
Convert currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Paperback Quantity: 1
Seller:
GoldenWavesOfBooks
(Fayetteville, TX, U.S.A.)

Book Description Paperback. Condition: new. New. Fast Shipping and good customer service. Seller Inventory # Holz_New_0596514336

More information about this seller | Contact seller

Buy New
£ 17.98
Convert currency

Add to Basket

Shipping: £ 3.22
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell J.T.
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Paperback Quantity: 1
Seller:
GridFreed
(North Las Vegas, NV, U.S.A.)

Book Description Paperback. Condition: New. In shrink wrap. Seller Inventory # 10-03003

More information about this seller | Contact seller

Buy New
£ 17.30
Convert currency

Add to Basket

Shipping: £ 4.38
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell J.T.
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Softcover Quantity: > 20
Seller:
Lakeside Books
(Benton Harbor, MI, U.S.A.)

Book Description Condition: New. Brand New! Not Overstocks or Low Quality Book Club Editions! Direct From the Publisher! We're not a giant, faceless warehouse organization! We're a small town bookstore that loves books and loves it's customers! Buy from Lakeside Books!. Seller Inventory # OTF-S-9780596514334

More information about this seller | Contact seller

Buy New
£ 19.22
Convert currency

Add to Basket

Shipping: £ 3.21
Within U.S.A.
Destination, rates & speeds
Seller Image

Dyer, Russell J.
Published by O'Reilly Media 4/1/2008 (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Paperback or Softback Quantity: 5
Seller:
BargainBookStores
(Grand Rapids, MI, U.S.A.)

Book Description Paperback or Softback. Condition: New. MYSQL in a Nutshell 1.69. Book. Seller Inventory # BBS-9780596514334

More information about this seller | Contact seller

Buy New
£ 22.54
Convert currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Paperback Quantity: 1
Seller:
Wizard Books
(Long Beach, CA, U.S.A.)

Book Description Paperback. Condition: new. New. Seller Inventory # Wizard0596514336

More information about this seller | Contact seller

Buy New
£ 21.86
Convert currency

Add to Basket

Shipping: £ 2.81
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Softcover Quantity: > 20
Seller:
Lucky's Textbooks
(Dallas, TX, U.S.A.)

Book Description Condition: New. Seller Inventory # ABLIING23Feb2416190070979

More information about this seller | Contact seller

Buy New
£ 22.36
Convert currency

Add to Basket

Shipping: £ 3.21
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Softcover Quantity: > 20
Seller:
California Books
(Miami, FL, U.S.A.)

Book Description Condition: New. Seller Inventory # I-9780596514334

More information about this seller | Contact seller

Buy New
£ 25.68
Convert currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, rates & speeds
Seller Image

Dyer, Russell J. T.
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Softcover Quantity: 1
Seller:
GreatBookPrices
(Columbia, MD, U.S.A.)

Book Description Condition: New. Seller Inventory # 5315267-n

More information about this seller | Contact seller

Buy New
£ 23.65
Convert currency

Add to Basket

Shipping: £ 2.12
Within U.S.A.
Destination, rates & speeds
Stock Image

Dyer, Russell
Published by O'Reilly Media (2008)
ISBN 10: 0596514336 ISBN 13: 9780596514334
New Paperback Quantity: 1
Seller:
GoldBooks
(Denver, CO, U.S.A.)

Book Description Paperback. Condition: new. New Copy. Customer Service Guaranteed. Seller Inventory # think0596514336

More information about this seller | Contact seller

Buy New
£ 23.46
Convert currency

Add to Basket

Shipping: £ 3.42
Within U.S.A.
Destination, rates & speeds

There are more copies of this book

View all search results for this book