Book 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. The book 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. Learn how to:
- Wrangle data in the most efficient way possible
- Aggregate and organize your data for meaningful and accurate reporting
- Make the most of subqueries, joins, and unions
- Stay on top of the performance of your queries and the server that runs them
- Avoid common SQL security pitfalls, including the dreaded SQL injection attack
Let SQL Hacks serve as your toolbox for digging up and manipulating data. If you love to tinker and optimize, SQL is the perfect technology and SQL Hacks is the must-have book for you.
Publisher resources
Table of contents
- A Note Regarding Supplemental Files
- Credits
- Preface
- 1. SQL Fundamentals
- 2. Joins, Unions, and Views
- 3. Text Handling
- 4. Date Handling
-
5. Number Crunching
- Multiply Across a Result Set
- Keep a Running Total
- Include the Rows Your JOIN Forgot
- Identify Overlapping Ranges
- Avoid Dividing by Zero
- Other Ways to COUNT
- Calculate the Maximum of Two Fields
- Disaggregate a COUNT
- Cope with Rounding Errors
- Get Values and Subtotals in One Shot
- Calculate the Median
- Tally Results into a Chart
- Calculate the Distance Between GPS Locations
- Reconcile Invoices and Remittances
- Find Transposition Errors
- Apply a Progressive Tax
- Calculate Rank
- 6. Online Applications
- 7. Organizing Data
- 8. Storing Small Amounts of Data
-
9. Locking and Performance
- Determine Your Isolation Level
- Use Pessimistic Locking
- Use Optimistic Locking
- Lock Implicitly Within Transactions
- Cope with Unexpected Redo
- Execute Functions in the Database
- Combine Your Queries
- Extract Lots of Rows
- Extract a Subset of the Results
- Mix File and Database Storage
- Compare and Synchronize Tables
- Minimize Bandwidth in One-to-Many Joins
- Compress to Avoid LOBs
-
10. Reporting
- Fill in Missing Values in a Pivot Table
- Break It Down by Range
- Identify Updates Uniquely
- Play Six Degrees of Kevin Bacon
- Build Decision Tables
- Generate Sequential or Missing Data
- Find the Top n in Each Group
- Store Comma-Delimited Lists in a Column
- Traverse a Simple Tree
- Set Up Queuing in the Database
- Generate a Calendar
- Test Two Values from a Subquery
- Choose Any Three of Five
- 11. Users and Administration
- 12. Wider Access
- Index
- About the Authors
- Colophon
- Copyright
Product information
- Title: SQL Hacks
- Author(s):
- Release date: November 2006
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596527990
You might also like
book
SQL Tuning
A poorly performing database application not only costs users time, but also has an impact on …
video
SQL in Motion
See it. Do it. Learn it! SQL in Motion introduces the SQL database language through high-quality …
book
Learn SQL Database Programming
Learn everything you need to know to build efficient SQL queries using this easy-to-follow beginner's guide …
book
Microsoft SQL Server 2014 Query Tuning & Optimization
Optimize Microsoft SQL Server 2014 queries and applications Microsoft SQL Server 2014 Query Tuning & Optimization …