书籍详情

Effective SQL:编写高质量SQL语句的61条有效方法(英文版)

Effective SQL:编写高质量SQL语句的61条有效方法(英文版)

作者:[法] John L. Viescas(约翰-L-威克斯),[加拿大] Douglas J.Steele(道格拉斯-J-斯蒂尔) 著

出版社:电子工业出版社

出版时间:2017-08-01

ISBN:9787121322846

定价:¥89.00

购买这本书可以去
内容简介
  本书全面系统地介绍了SQL语言各方面的基础知识以及一些高级特性,包括SQL数据语言、SQL方案语言、数据集操作、子查询以及内建函数与条件逻辑等内容。书中每个章节讲述一个相对独立的主题,并提供了相关示例和练习。涵盖了市场上常用数据库版本(MySQL 、Oracle 及Microsoft SQL Server等 )。同时针对开发基于数据库的应用程序,以及日常的数据库系统管理,本书都展现了大量经过实践检验的方法和技巧。读者可以通过对本书循序渐进地学习快速掌握SQL语言,也可以在实际工作中遇到问题时直接翻阅本书中的相关章节以获取解决方案。
作者简介
  John L. Viescas是一位有着超过45年从业经验的独立数据库顾问。他从一位系统分析师开始他的职业生涯,为IBM大型机系统设计大型数据库应用。他在达拉斯的应用数据研究中心工作了六年,在那里他带领30多名员工负责IBM大型计算机数据库产品的研究、开发以及客户支持工作。在应用数据研究工作期间,约翰完成了达拉斯德克萨斯大学的商业金融学位,并以优异的成绩毕业。John 1988年加入Tandem 计算机公司,在那里他负责在Tandem公司美国西部销售区开发和实施数据库的营销方案。他开发并交付了用于技术研讨会的关系数据库管理系统―― NonStop SQL。约翰1989年写了他的**本书,A Quick Reference Guide to SQL(Microsoft Press,1989),该书一本是对比了ANSI-86 SQL 标准、IBM的DB2、微软的SQL Server、甲骨文公司的Oracle、以及Tandem公司的NonStop SQL之间的语法相似性的研究类书。作者于1992年从Tandem公司公休时写了Running Microsoft Access**版(Microsoft Press,1992年)。他已经写了四个版本的Running Microsoft Access,以及Running系列的后续作品――三个版本的Microsoft Office Access Inside Out(Microsoft Press,2003、2007、2010)和Building Microsoft Access Applications(Microsoft Press,2005)。他也是畅销书籍SQL Queries for Mere Mortals(Addison Wesley,2014)第三版的作者。John目前保持着连续多年被微软授予微机数据库管理系统*有价值专家(MVP,Most Valuable Professional)的纪录(1993年至2015年)。John与他的妻子在法国巴黎定居了三十多年。Douglas J. Steele从事包括大型机和个人机在内的计算机相关的工作超过45年(是的,他一开始是用穿孔卡的!)。在2012退休前,他在一家大型国际石油公司工作了31年多。尽管他职业生涯的高光时刻是通过发展SCCM任务序列将Windows 7推广到全球超过10万台电脑上,但是数据库和数据建模是他的主要工作方向。Douglas超过17年被微软认证为*有价值专家(MVP),他撰写了大量关于Access数据库的文章,Douglas是Microsoft Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs(Wiley,2010)的合著者,也是很多书的技术编辑。Douglas为滑铁卢大学系统设计工程硕士,专注于设计非传统电脑用户的用户界面研究。(当然,在七十年代末,很少有人是传统的电脑用户!)他的专业研究源于他的音乐背景(他拥有多伦多英国皇家音乐学院钢琴演奏准学士学位)。他还痴迷于啤酒并毕业于尼亚加拉学院酿酒及啤酒厂操作管理专业(滨湖尼亚加拉,安大略省)。Douglas和他的妻子在加拿大安大略省圣凯瑟琳定居超过34年。读者可以通过邮箱:mvphelp@gmail.com联系Douglas。Ben G. Clothier是芝加哥首屈一指的Access和SQL Server开发企业IT Impact公司的解决方案架构师。他曾在著名J Street Technology和Advisicon公司做过自由顾问,主要从事从小型个人解决方案到公司全业务应用程序Access项目的相关工作。值得注意的项目包括一家水泥公司的工作跟踪和库存管理系统、给保险商使用的医疗保险计划生成器以及国际航运公司的订单管理系统。Ben在UtterAccess是系统管理员,并且和Teresa Hennig、George Hepworth、Doug Yudovich合著了Professional Access? 2013 Programming(Wiley,2013);并与Tim Runcie和George Hepworth一起合著了Microsoft? Access in a SharePoint World(Advisicon,2011);Ben还是Microsoft? Access? 2010 Programmer’s Reference(Wiley,2010)一书的特约作者。他拥有微软SQL Server 2012解决方案认证和MySQL 5认证开发者等证书。从2009年开始Ben一直是微软的*有价值专家(MVP)。影印版,无译者
目录
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
猜您喜欢

读书导航