close menu
Bookswagon-24x7 online bookstore
close menu
My Account
Effective SQL: 61 Specific Ways to Write Better SQL(Effective Software Development Series)

Effective SQL: 61 Specific Ways to Write Better SQL(Effective Software Development Series)

          
5
4
3
2
1

Out of Stock


Premium quality
Premium quality
Bookswagon upholds the quality by delivering untarnished books. Quality, services and satisfaction are everything for us!
Easy Return
Easy return
Not satisfied with this product! Keep it in original condition and packaging to avail easy return policy.
Certified product
Certified product
First impression is the last impression! Address the book’s certification page, ISBN, publisher’s name, copyright page and print quality.
Secure Checkout
Secure checkout
Security at its finest! Login, browse, purchase and pay, every step is safe and secured.
Money back guarantee
Money-back guarantee:
It’s all about customers! For any kind of bad experience with the product, get your actual amount back after returning the product.
On time delivery
On-time delivery
At your doorstep on time! Get this book delivered without any delay.
Notify me when this book is in stock
Add to Wishlist

About the Book

“Given the authors’ reputations, I expected to be impressed. I was blown away! . . . Most SQL books sit on my shelf. This one will live on my desk.”
–Roger Carlson, Microsoft Access MVP (2006-2015)

“Rather than stumble around reinventing wheels or catching glimpses of the proper approaches, do yourself a favor: Buy this book.”
—Dave Stokes, MySQL Community Manager, Oracle Corporation

Effective SQL brings together practical solutions and insights so you can solve complex problems with SQL and design databases that simplify data management in the future. It’s the only modern book that brings together advanced best practices and realistic example code for all of these versions of SQL: IBM DB2, Microsoft Access, Microsoft SQL Server, MySQL, Oracle Database, and PostgreSQL.

Drawing on their immense experience as world-class database consultants and instructors, the authors identify 61 proven approaches to writing better SQL. Wherever SQL versions vary, the authors illuminate the key nuances, so you can get the most out of whatever version you prefer. This full-color guide provides clear, practical explanations; expert tips; and plenty of usable code. Going far beyond mere syntax, it addresses issues ranging from optimizing database designs to managing hierarchies and metadata. If you already know SQL’s basics, this guide will help you become a world-class SQL problem-solver.

  • Craft better logical data models, and fix flawed models
  • Implement indexes that improve query performance
  • Handle external data from sources you don’t control
  • Extract and aggregate the information you need, as efficiently as possible
  • Write more flexible subqueries
  • Analyze and retrieve metadata using your database platform of choice
  • Use Cartesian Products and Tally Tables to solve problems you can’t address with conventional JOINs
  • Model hierarchical data: managing SQL’s tradeoffs and shortcomings


Table of Contents:

Foreword xiii

Acknowledgments xv

About the Authors xvii

About the Technical Editors xix

 

Introduction 1

A Brief History of SQL 1

Database Systems We Considered 5

Sample Databases 6

Where to Find the Samples on GitHub 7

Summary of the Chapters 8

 

Chapter 1: Data Model Design 11

Item 1: Verify That All Tables Have a Primary Key 11

Item 2: Eliminate Redundant Storage of Data Items 15

Item 3: Get Rid of Repeating Groups 19

Item 4: Store Only One Property per Column 21

Item 5: Understand Why Storing Calculated Data Is Usually a Bad Idea 25

Item 6: Define Foreign Keys to Protect Referential Integrity 30

Item 7: Be Sure Your Table Relationships Make Sense 33

Item 8: When 3NF Is Not Enough, Normalize More 37

Item 9: Use Denormalization for Information Warehouses 43

 

Chapter 2: Programmability and Index Design 47

Item 10: Factor in Nulls When Creating Indexes 47

Item 11: Carefully Consider Creation of Indexes to Minimize Index and Data Scanning 52

Item 12: Use Indexes for More than Just Filtering 56

Item 13: Don’t Go Overboard with Triggers 61

Item 14: Consider Using a Filtered Index to Include or Exclude a Subset of Data 65

Item 15: Use Declarative Constraints Instead of Programming Checks 68

Item 16: Know Which SQL Dialect Your Product Uses and Write Accordingly 70

Item 17: Know When to Use Calculated Results in Indexes 74

 

Chapter 3: When You Can’t Change the Design 79

Item 18: Use Views to Simplify What Cannot Be Changed 79

Item 19: Use ETL to Turn Nonrelational Data into Information 85

Item 20: Create Summary Tables and Maintain Them 90

Item 21: Use UNION Statements to “Unpivot” Non-normalized Data 94

 

Chapter 4: Filtering and Finding Data 101

Item 22: Understand Relational Algebra and How It Is Implemented in SQL 101

Item 23: Find Non-matches or Missing Records 108

Item 24: Know When to Use CASE to Solve a Problem 110

Item 25: Know Techniques to Solve Multiple-Criteria Problems 115

Item 26: Divide Your Data If You Need a Perfect Match 120

Item 27: Know How to Correctly Filter a Range of Dates on a Column Containing Both Date and Time 124

Item 28: Write Sargable Queries to Ensure That the Engine Will Use Indexes 127

Item 29: Correctly Filter the “Right” Side of a “Left” Join 132

 

Chapter 5: Aggregation 135

Item 30: Understand How GROUP BY Works 135

Item 31: Keep the GROUP BY Clause Small 142

Item 32: Leverage GROUP BY/HAVING to Solve Complex Problems 145

Item 33: Find Maximum or Minimum Values Without Using GROUP BY 150

Item 34: Avoid Getting an Erroneous COUNT() When Using OUTER JOIN 156

Item 35: Include Zero-Value Rows When Testing for HAVING COUNT(x) < Some Number 159

Item 36: Use DISTINCT to Get Distinct Counts 163

Item 37: Know How to Use Window Functions 166

Item 38: Create Row Numbers and Rank a Row over Other Rows 169

Item 39: Create a Moving Aggregate 172

 

Chapter 6: Subqueries 179

Item 40: Know Where You Can Use Subqueries 179

Item 41: Know the Difference between Correlated and Non-correlated Subqueries 184

Item 42: If Possible, Use Common Table Expressions Instead of Subqueries 190

Item 43: Create More Efficient Queries Using Joins Rather than Subqueries 197

 

Chapter 7: Getting and Analyzing Metadata 201

Item 44: Learn to Use Your System’s Query Analyzer 201

Item 45: Learn to Get Metadata about Your Database 212

Item 46: Understand How the Execution Plan Works 217

 

Chapter 8: Cartesian Products 227

Item 47: Produce Combinations of Rows between Two Tables and Flag Rows in the Second That Indirectly Relate to the First 227

Item 48: Understand How to Rank Rows by Equal Quantiles 231

Item 49: Know How to Pair Rows in a Table with All Other Rows 235

Item 50: Understand How to List Categories and the Count of First, Second, or Third Preferences 240

 

Chapter 9: Tally Tables 247

Item 51: Use a Tally Table to Generate Null Rows Based on a Parameter 247

Item 52: Use a Tally Table and Window Functions for Sequencing 252

Item 53: Generate Multiple Rows Based on Range Values in a Tally Table 257

Item 54: Convert a Value in One Table Based on a Range of Values in a Tally Table 261

Item 55: Use a Date Table to Simplify Date Calculation 268

Item 56: Create an Appointment Calendar Table with All Dates Enumerated in a Range 275

Item 57: Pivot Data Using a Tally Table 278

 

Chapter 10: Modeling Hierarchical Data 285

Item 58: Use an Adjacency List Model as the Starting Point 286

Item 59: Use Nested Sets for Fast Querying Performance with Infrequent Updates 288

Item 60: Use a Materialized Path for Simple Setup and Limited Searching 291

Item 61: Use Ancestry Traversal Closure for Complex Searching 294

 

Appendix: Date and Time Types, Operations, and Functions 299

IBM DB2 299

Microsoft Access 303

Microsoft SQL Server 305

MySQL 308

Oracle 313

PostgreSQL 315

 

Index 317


Best Seller

| | See All

Product Details
  • ISBN-13: 9780134579146
  • Publisher: Pearson Education (US)
  • Publisher Imprint: Addison Wesley
  • Language: English
  • Series Title: Effective Software Development Series
  • Weight: 1 gr
  • ISBN-10: 0134579143
  • Publisher Date: 09 Jan 2017
  • Binding: Digital download
  • No of Pages: 320
  • Sub Title: 61 Specific Ways to Write Better SQL


Similar Products

How would you rate your experience shopping for books on Bookswagon?

Add Photo
Add Photo

Customer Reviews

REVIEWS           
Be The First to Review
Effective SQL: 61 Specific Ways to Write Better SQL(Effective Software Development Series)
Pearson Education (US) -
Effective SQL: 61 Specific Ways to Write Better SQL(Effective Software Development Series)
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Effective SQL: 61 Specific Ways to Write Better SQL(Effective Software Development Series)

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book
    Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals

    | | See All


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!
    ASK VIDYA