Effective SQL brings together the hands-on solutions and practical insights you need to solve a wide range of complex problems with SQL, and to design databases that make it far easier to manage data in the future. Leveraging the proven format of the best-selling Effective series, it focuses on providing clear, practical explanations, expert tips, and plenty of realistic examples -- all in full color.
Drawing on their immense experience as consultants and instructors, three world-class database experts identify specific challenges, and distill each solution into five pages or less. Throughout, they provide well-annotated SQL code designed for all leading platforms, as well as code for specific implementations ranging from SQL Server to Oracle and MySQL, wherever these vary or permit you to achieve your goal more efficiently.
Going beyond mere syntax, the authors also show how to avoid poor database design that makes it difficult to write effective SQL, how to improve suboptimal designs, and how to work around designs you can't change. You'll also find detailed sections on filtering and finding data, aggregation, subqueries, and metadata, as well as specific solutions for everything from listing products to scheduling events and defining data hierarchies. Simply put, if you already know the basics of SQL, Effective SQL will help you become a world-class SQL problem-solver.
Autorentext
John L. Viescas is an independent database consultant with more than 45 years of experience. He began his career as a systems analyst, designing large database applications for IBM mainframe systems. He spent six years at Applied Data Research in Dallas, Texas, where he directed a staff of more than 30 people and was responsible for research, product development, and customer support of database products for IBM mainframe computers. While working at Applied Data Research, John completed a degree in business finance at the University of Texas at Dallas, graduating cum laude.
John joined Tandem Computers, Inc., in 1988, where he was responsible for the development and implementation of database marketing programs in Tandem's U.S. Western Sales region. He developed and delivered technical seminars on Tandem's relational database management system, NonStop SQL. John wrote his first book, A Quick Reference Guide to SQL (Microsoft Press, 1989), as a research project to document the similarities in the syntax among the ANSI-86 SQL standard, IBM's DB2, Microsoft's SQL Server, Oracle Corporation's Oracle, and Tandem's NonStop SQL. He wrote the first edition of Running Microsoft® Access (Microsoft Press, 1992) while on sabbatical from Tandem. He has since written four editions of Running, three editions of Microsoft® Office Access Inside Out (Microsoft Press, 2003, 2007 and 2010-the successor to the Running series), and Building Microsoft® Access Applications (Microsoft Press, 2005). He is also the best-selling author of SQL Queries for Mere Mortals®, Third Edition (Addison-Wesley, 2014). John currently holds the record for the most consecutive years being awarded MVP from Microsoft, having received the award from 1993-2015. John makes his home with his wife of more than 30 years in Paris, France.
Douglas J. Steele has been working with computers, both mainframe and PC, for almost 45 years. (Yes, he did use punch cards in the beginning!) He worked for a large international oil company for more than 31 years before retiring in 2012. Databases and data modeling were a focus for most of that time, although he finished his career by developing the SCCM task sequence to roll Windows 7 out to over 100,000 computers worldwide.
Recognized by Microsoft as an MVP (Most Valuable Professional) for more than 16 years, Doug has authored numerous articles on Access, was co-author of Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs (Wiley Publishing, 2010), and has been technical editor for a number of books.
Doug holds a master's degree in systems design engineering from the University of Waterloo (Ontario, Canada), where his research centered on designing user interfaces for non-traditional computer users. (Of course, this was in the late '70s, so few people were traditional computer users at the time!) This research stemmed from his background in music (he holds an associateship in piano performance from the Royal Conservatory of Music, Toronto). He is also obsessed with beer, and is a graduate of the brewmaster and brewery operations management program at Niagara College (Niagara-on-the-Lake, Ontario).
Doug lives with his lovely wife of more than 34 years in St. Catharines, Ontario. Doug can be reached at AccessMVPHelp@gmail.com.
Ben G. Clothier is a Solution Architect with IT Impact, Inc., a premier Access and SQL Server development shop based in Chicago, Illinois. He has worked as a freelance consultant with notable shops including J Street Technology and Advisicon, and has worked on Access projects from small, one-man solutions to company-wide line of business applications. Notable projects include job tracking and inventory for a cement company, a Medicare insurance plan generator for an insurance provider, and order management for an international shipping company. Ben is an administrator at UtterAccess and was a coauthor, with Teresa Hennig, George Hepworth and Doug Yudovich of Microsoft® Access 2013 Programming (Wiley 2013), and with Tim Runcie and George Hepworth, of Microsoft® Access in a SharePoint World (Advisicon, 2011), and a contributing author for Access 2010 Programmer's Reference (Wiley, 2010). He holds certifications for Microsoft SQL Server 2012 Solution Associate and MySQL 5.0 Certified Developer, among others. He has been a Microsoft MVP since 2009.
Ben lives in San Antonio, Texas, with his wife, Suzanne, and his son, Harry.
Inhalt
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