Oreilly - Mysql Cookbook (2002).pdf

(4093 KB) Pobierz
Cookbook.PDF
MySQL Cookbook
By Paul DuBois
Publisher
: O'Reilly
Pub Date
: October 2002
20180744.001.png
ISBN
: 0-596-00145-2
Pages
: 1022
MySQL Cookbook provides a unique problem-and-solution format that offers practical
examples for everyday programming dilemmas. For every problem addressed in the book,
there's a worked-out solution or "recipe" -- short, focused pieces of code that you can insert
directly into your applications. More than a collection of cut-and-paste code, this book
explanation how and why the code works, so you can learn to adapt the techniques to similar
situations.
Copyright
Preface
Who This Book Is For
What's in This Book
Platform Notes
Conventions Used in This Book
The Companion Web Site
Comments and Questions
Additional Resources
Acknowledgments
Chapter 1. Using the mysql Client Program
Section 1.2. Setting Up a MySQL User Account
Section 1.3. Creating a Database and a Sample Table
Section 1.4. Starting and Terminating mysql
Section 1.5. Specifying Connection Parameters by Using Option Files
Section 1.6. Protecting Option Files
Section 1.7. Mixing Command-Line and Option File Parameters
Section 1.8. What to Do if mysql Cannot Be Found
Section 1.9. Setting Environment Variables
Section 1.10. Issuing Queries
Section 1.11. Selecting a Database
Section 1.12. Canceling a Partially Entered Query
Section 1.13. Repeating and Editing Queries
Section 1.14. Using Auto-Completion for Database and Table Names
Section 1.15. Using SQL Variables in Queries
Section 1.16. Telling mysql to Read Queries from a File
Section 1.17. Telling mysql to Read Queries from Other Programs
Section 1.18. Specifying Queries on the Command Line
Section 1.19. Using Copy and Paste as a mysql Input Source
Section 1.20. Preventing Query Output from Scrolling off the Screen
Section 1.21. Sending Query Output to a File or to a Program
Section 1.22. Selecting Tabular or Tab-Delimited Query Output Format
Section 1.23. Specifying Arbitrary Output Column Delimiters
Section 1.24. Producing HTML Output
Section 1.25. Producing XML Output
Section 1.26. Suppressing Column Headings in Query Output
Section 1.27. Numbering Query Output Lines
Section 1.28. Making Long Output Lines More Readable
Section 1.29. Controlling mysql's Verbosity Level
Section 1.30. Logging Interactive mysql Sessions
MySQL APIs Used in This Book
Section 1.1. Introduction
20180744.002.png
Section 1.31. Creating mysql Scripts from Previously Executed Queries
Section 1.32. Using mysql as a Calculator
Section 1.33. Using mysql in Shell Scripts
Chapter 2. Writing MySQL-Based Programs
Section 2.2. Connecting to the MySQL Server, Selecting a Database, and Disconnecting
Section 2.3. Checking for Errors
Section 2.4. Writing Library Files
Section 2.5. Issuing Queries and Retrieving Results
Section 2.6. Moving Around Within a Result Set
Section 2.7. Using Prepared Statements and Placeholders in Queries
Section 2.8. Including Special Characters and NULL Values in Queries
Section 2.9. Handling NULL Values in Result Sets
Section 2.10. Writing an Object-Oriented MySQL Interface for PHP
Section 2.11. Ways of Obtaining Connection Parameters
Section 2.12. Conclusion and Words of Advice
Chapter 3. Record Selection Techniques
Section 3.2. Specifying Which Columns to Display
Section 3.3. Avoiding Output Column Order Problems When Writing Programs
Section 3.4. Giving Names to Output Columns
Section 3.5. Using Column Aliases to Make Programs Easier to Write
Section 3.6. Combining Columns to Construct Composite Values
Section 3.7. Specifying Which Rows to Select
Section 3.8. WHERE Clauses and Column Aliases
Section 3.9. Displaying Comparisons to Find Out How Something Works
Section 3.10. Reversing or Negating Query Conditions
Section 3.11. Removing Duplicate Rows
Section 3.12. Working with NULL Values
Section 3.13. Negating a Condition on a Column That Contains NULL Values
Section 3.14. Writing Comparisons Involving NULL in Programs
Section 3.15. Mapping NULL Values to Other Values for Display
Section 3.16. Sorting a Result Set
Section 3.17. Selecting Records from the Beginning or End of a Result Set
Section 3.18. Pulling a Section from the Middle of a Result Set
Section 3.19. Choosing Appropriate LIMIT Values
Section 3.20. Calculating LIMIT Values from Expressions
Section 3.21. What to Do When LIMIT Requires the "Wrong" Sort Order
Section 3.22. Selecting a Result Set into an Existing Table
Section 3.23. Creating a Destination Table on the Fly from a Result Set
Section 3.24. Moving Records Between Tables Safely
Section 2.1. Introduction
Section 3.1. Introduction
20180744.003.png
Section 3.25. Creating Temporary Tables
Section 3.26. Cloning a Table Exactly
Section 3.27. Generating Unique Table Names
Chapter 4. Working with Strings
Section 4.2. Writing Strings That Include Quotes or Special Characters
Section 4.3. Preserving Trailing Spaces in String Columns
Section 4.4. Testing String Equality or Relative Ordering
Section 4.5. Decomposing or Combining Strings
Section 4.6. Checking Whether a String Contains a Substring
Section 4.7. Pattern Matching with SQL Patterns
Section 4.8. Pattern Matching with Regular Expressions
Section 4.9. Matching Pattern Metacharacters Literally
Section 4.10. Controlling Case Sensitivity in String Comparisons
Section 4.11. Controlling Case Sensitivity in Pattern Matching
Section 4.12. Using FULLTEXT Searches
Section 4.13. Using a FULLTEXT Search with Short Words
Section 4.14. Requiring or Excluding FULLTEXT Search Words
Section 4.15. Performing Phrase Searches with a FULLTEXT Index
Chapter 5. Working with Dates and Times
Section 5.2. Changing MySQL's Date Format
Section 5.3. Telling MySQL How to Display Dates or Times
Section 5.4. Determining the Current Date or Time
Section 5.5. Decomposing Dates and Times Using Formatting Functions
Section 5.6. Decomposing Dates or Times Using Component-Extraction Functions
Section 5.7. Decomposing Dates or Times Using String Functions
Section 5.8. Synthesizing Dates or Times Using Formatting Functions
Section 5.9. Synthesizing Dates or Times Using Component-Extraction Functions
Section 5.10. Combining a Date and a Time into a Date-and-Time Value
Section 5.11. Converting Between Times and Seconds
Section 5.12. Converting Between Dates and Days
Section 5.13. Converting Between Date-and-Time Values and Seconds
Section 5.14. Adding a Temporal Interval to a Time
Section 5.15. Calculating Intervals Between Times
Section 5.16. Breaking Down Time Intervals into Components
Section 5.17. Adding a Temporal Interval to a Date
Section 5.18. Calculating Intervals Between Dates
Section 5.19. Canonizing Not-Quite-ISO Date Strings
Section 5.20. Calculating Ages
Section 5.21. Shifting Dates by a Known Amount
Section 4.1. Introduction
Section 5.1. Introduction
20180744.004.png
Zgłoś jeśli naruszono regulamin