Buying Options
SQL Hacks
Print $29.99
Add to Cart
Print+Ebook $32.99
Add to Cart
Ebook $23.99
Add to Cart
Safari Books Online
Add to Cart
What is this?
Print £22.99
Add to Cart
What is this?
Description
Whether you're running Access, MySQL, SQL Server, Oracle, or PostgreSQL, this book will help you push the limits of traditional SQL to squeeze data effectively from your database. SQL Hacks offers 100 hacks -- unique tips and tools -- that bring you the knowledge of experts who apply what they know in the real world to help you take full advantage of the expressive power of SQL. You'll find practical techniques to address complex data manipulation problems.
Full Description
Table of Contents
  1. Chapter 1 SQL Fundamentals

    1. Run SQL from the Command Line

    2. Connect to SQL from a Program

    3. Perform Conditional INSERTs

    4. UPDATE the Database

    5. Solve a Crossword Puzzle Using SQL

    6. Don’t Perform the Same Calculation Over and Over

  2. Chapter 2 Joins, Unions, and Views

    1. Modify a Schema Without Breaking Existing Queries

    2. Filter Rows and Columns

    3. Filter on Indexed Columns

    4. Convert Subqueries to JOINs

    5. Convert Aggregate Subqueries to JOINs

    6. Simplify Complicated Updates

    7. Choose the Right Join Style for Your Relationships

    8. Generate Combinations

  3. Chapter 3 Text Handling

    1. Search for Keywords Without LIKE

    2. Search for a String Across Columns

    3. Solve Anagrams

    4. Sort Your Email

  4. Chapter 4 Date Handling

    1. Convert Strings to Dates

    2. Uncover Trends in Your Data

    3. Report on Any Date Criteria

    4. Generate Quarterly Reports

    5. Second Tuesday of the Month

  5. Chapter 5 Number Crunching

    1. Multiply Across a Result Set

    2. Keep a Running Total

    3. Include the Rows Your JOIN Forgot

    4. Identify Overlapping Ranges

    5. Avoid Dividing by Zero

    6. Other Ways to COUNT

    7. Calculate the Maximum of Two Fields

    8. Disaggregate a COUNT

    9. Cope with Rounding Errors

    10. Get Values and Subtotals in One Shot

    11. Calculate the Median

    12. Tally Results into a Chart

    13. Calculate the Distance Between GPS Locations

    14. Reconcile Invoices and Remittances

    15. Find Transposition Errors

    16. Apply a Progressive Tax

    17. Calculate Rank

  6. Chapter 6 Online Applications

    1. Copy Web Pages into a Table

    2. Present Data Graphically Using SVG

    3. Add Navigation Features to Web Applications

    4. Tunnel into MySQL from Microsoft Access

    5. Process Web Server Logs

    6. Store Images in a Database

    7. Exploit an SQL Injection Vulnerability

    8. Prevent an SQL Injection Attack

  7. Chapter 7 Organizing Data

    1. Keep Track of Infrequently Changing Values

    2. Combine Tables Containing Different Data

    3. Display Rows As Columns

    4. Display Columns As Rows

    5. Clean Inconsistent Records

    6. Denormalize Your Tables

    7. Import Someone Else’s Data

    8. Play Matchmaker

    9. Generate Unique Sequential Numbers

  8. Chapter 8 Storing Small Amounts of Data

    1. Store Parameters in the Database

    2. Define Personalized Parameters

    3. Create a List of Personalized Parameters

    4. Set Security Based on Rows

    5. Issue Queries Without Using a Table

    6. Generate Rows Without Tables

  9. Chapter 9 Locking and Performance

    1. Determine Your Isolation Level

    2. Use Pessimistic Locking

    3. Use Optimistic Locking

    4. Lock Implicitly Within Transactions

    5. Cope with Unexpected Redo

    6. Execute Functions in the Database

    7. Combine Your Queries

    8. Extract Lots of Rows

    9. Extract a Subset of the Results

    10. Mix File and Database Storage

    11. Compare and Synchronize Tables

    12. Minimize Bandwidth in One-to-Many Joins

    13. Compress to Avoid LOBs

  10. Chapter 10 Reporting

    1. Fill in Missing Values in a Pivot Table

    2. Break It Down by Range

    3. Identify Updates Uniquely

    4. Play Six Degrees of Kevin Bacon

    5. Build Decision Tables

    6. Generate Sequential or Missing Data

    7. Find the Top n in Each Group

    8. Store Comma-Delimited Lists in a Column

    9. Traverse a Simple Tree

    10. Set Up Queuing in the Database

    11. Generate a Calendar

    12. Test Two Values from a Subquery

    13. Choose Any Three of Five

  11. Chapter 11 Users and Administration

    1. Implement Application-Level Accounts

    2. Export and Import Table Definitions

    3. Deploy Applications

    4. Auto-Create Database Users

    5. Create Users and Administrators

    6. Issue Automatic Updates

    7. Create an Audit Trail

  12. Chapter 12 Wider Access

    1. Sharing Data Across the Internet

    2. Allow an Anonymous Account

    3. Find and Stop Long-Running Queries

    4. Don’t Run Out of Disk Space

    5. Run SQL from a Web Page

  1. Colophon

View Full Table of Contents
Product Details
Title:
SQL Hacks
By:
Andrew Cumming, Gordon Russell
Publisher:
O'Reilly Media
Formats:
  • Print
  • Ebook
  • Safari Books Online
Print Release:
November 2006
Ebook Release:
February 2009
Pages:
416
Print ISBN:
978-0-596-52799-0
| ISBN 10:
0-596-52799-3
Ebook ISBN:
978-0-596-10255-5
| ISBN 10:
0-596-10255-0
Customer Reviews
About the Authors
  1. Andrew Cumming

    Andrew Cumming is the Zoo Keeper at http://sqlzoo.net . He keeps a collection of tame SQL engines and presents these to the public. He cares for these beasts, protecting them from the abuse inflicted by SQL learners, and protecting SQL learners from the injuries that the wild engines can inflict. But mostly he shovels manure out the cages and hoses them down every now and then. Andrew also teaches at Napier University in Edinburgh, Scotland.

    View Andrew Cumming's full profile page.

  2. Gordon Russell

    Dr. Gordon Russell is a Computing lecturer in Napier University, Scotland. He teaches databases, Linux, and networking. He also builds educational websites, concentrating on technology-driven online learning environments. These include db.grussell.org, whose claim-to-fame is its automatic checking of SQL assessments, and http://linuxzoo.net, which offers online users root free access to Linux servers. But without database technology to support these sites, even he would be lost.

    View Gordon Russell's full profile page.

  • Book cover of SQL Hacks