SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL (Paperback)

Michael J. Hernandez, John L. Viescas

  • 出版商: Addison Wesley
  • 出版日期: 2000-08-31
  • 定價: $1,980
  • 售價: 5.0$990
  • 語言: 英文
  • 頁數: 528
  • 裝訂: Paperback
  • ISBN: 0201433362
  • ISBN-13: 9780201433364
  • 相關分類: SQL
  • 立即出貨(限量) (庫存=9)

買這商品的人也買了...

相關主題

商品描述


Description

The practical, hands-on, plain-English guide to getting results with SQL!

  • No unnecessary jargon: just real help and useful examples!
  • Covers every SQL skill business database users need most: drawing data from multiple tables, grouping, totaling, summaries, and much more.
  • CD-ROM contains five real-world sample databases for use with the book's example queries.
Now there's a practical, hands-on guide to SQL for millions of beginning-to-intermediate database users who desperately need to create fast, accurate, effective queries -- whether they have formal database training or not. The authors begin by introducing the fundamental concepts underlying relational databases and SQL. They then introduce the absolute basics of SQL, including the SELECT statement, creating expressions, and applying filters. Next, they introduce techniques for solving one of the most common problems database users encounter: drawing data from multiple tables at once. The book includes detailed coverage of grouping, totaling, and summarizing data; using SQL to update, insert, and delete data; and more. In the final section, Hernandez and Viescas introduce "thinking out of the box" techniques that allow users to solve a wide variety of complex SQL problems. Most chapters end with sample problems, solutions, and result sets -- all based on a library of five real-world databases included on the accompanying CD-ROM.

Michael J. Hernandez is a well-known relational database consultant, top-rated Microsoft Access instructor, and owner of DataTex Consulting Group in Seattle, WA. He is author of the best-selling Database Design for Mere Mortals, 0-201-69471-9. John L. Viescas is President of Viescas Consulting, Inc., a respected provider of database consulting services. He is the author of Running Microsoft Access 97 and Quick Reference Guide to SQL, which has been hailed as "the Strunk and White of SQL."

Back to Top


Table Of Contents

Foreword.
Preface and Acknowledgments.
About the Authors.
Introduction.
Are You a Mere Mortal?
About This Book.
How to Use This Book.
Reading the Diagrams Used in This Book.
Sample Databases Used in This Book.
"Follow the Yellow Brick Road".

I. RELATIONAL DATABASES AND SQL.


1. What Is "Relational?"
Topics Covered in This Chapter.
Types of Databases.
A Brief History of the Relational Model.
In the Beginning . . ..
Relational Database Software.

Anatomy of a Relational Database.
Tables.
Fields.
Records.
Keys.
Views.
Relationships.

What's in It for Me?
"Where Do I Go from Here?"


2. Ensuring Your Database Structure Is Sound.
Topics Covered in This Chapter.
Why Is This Chapter Here?
Why Worry about Sound Structures?
Fine-tuning Fields.
What's in a Name? (Part One).
Smoothing Out the Rough Edges.
Resolving Multipart Fields.
Resolving Multivalued Fields.

Fine-tuning Tables.
What's in a Name? (Part Two).
Ensuring a Sound Structure.
Resolving Unnecessary Duplicate Fields.
Identification Is the Key.

Establishing Solid Relationships.
Establishing a Deletion Rule.
Setting the TYpe of Participation.
Setting the Degree of Participation.

Is That All?

3. A Concise History of SQL.
Topics Covered in This Chapter.
The Origins of SQL.
Early Vendor Implementation.
". . . And Then There Was a Standard".
Evolution of the ANSI/ISO Standard.
Other SQL Standards.
Commercial Implementations.

What the Future Holds.
Why Should You Learn SQL?

II. SQL BASICS.


4. Creating a Simple Query.
Topics Covered in This Chapter.
Introducing SELECT.
The SELECT Statement.
Major Clauses in a SELECT Statement.

A Quick Aside: Data vs. Information.
Translating Your Request into SQL.
Expanding the Field of Vision.

Eliminating Duplicate Rows.
Sorting Information.
First Things First: Collating Sequences.
Let's Now Come to Order.

Saving Your Work.
Sample Statements.
Problems for You to Solve.

5. Getting More Than Simple Columns.
Topics Covered in This Chapter.
The SELECT Clause: Take Two.
Specifying Explicit Values.

Moving Beyond Basic Information.
What Is an Expression?
What Are You Trying to Express?
Data Types in SQL.

Types of Expressions.
Concatenation.
Mathematical.
Date And Time Arithmetic.

Using Expressions in a SELECT Clause.
A Brief Digression: Value Expressions.

That "Nothing" Value--NULL.
Introducing Null.

Sample Statements.
Problems for You to Solve.

6. Filtering Your Data.
Topics Covered in This Chapter.
Refining What You See Using WHERE.
The WHERE Clause.
Using A WHERE Clause.

Defining Search Conditions.
Comparison.
Range.
Set Membership.
Pattern Match.
Null.
Excluding Rows with NOT.

Using Multiple Conditions.
Introducing AND and OR.
Excluding Rows: Take Two.
Order of Precedence.

Nulls Revisited: A Cautionary Note.
Expressing Conditions in Different Ways.
Sample Statements.
Problems for You to Solve.

III. WORKING WITH MULTIPLE TABLES.


7. Thinking in Sets.
Topics Covered in This Chapter.
What Is a Set, Anyway?
Operations on Sets.
Intersection.
Intersection in Set Theory.
Intersection between Result Sets.
Problems You Can Solve with INTERSECT.

Difference.
Difference in Set Theory.
Difference Between Result Sets.
Problems You Can Solve with DIFFERENCE.

Union.
Union in Set Theory.
Combining Result Sets Using UNION.
Problems You Can Solve with UNION.

SQL Set Operations.
"Classical" Set Operations vs. SQL.
Finding Common Values--INTERSECT.
Finding Missing Values--EXCEPT (Difference).
Combining Sets--UNION.


8. INNER JOINs.
Topics Covered in This Chapter.
What Is a JOIN?
The INNER JOIN.
What's "Legal" to JOIN?
Syntax.
Check Those Relationships!

Uses for INNER JOINs.
Find Related Rows.
Find Matching Values.

Sample Statements.
Two Tables.
More Than Two Tables.
Looking for Matching Values.

Problems for You to Solve.

9. OUTER JOINs.
Topics Covered in This Chapter.
What is an OUTER JOIN?
The Left/Right OUTER JOIN.
Syntax.

The FULL OUTER JOIN.
Syntax.
FULL OUTER JOIN on Non-Key Values.
UNION JOIN.

Uses for OUTER JOINS.
Find Missing Values.
Find Partially Matched Information.

Sample Statements.
Problems for You to Solve.

10. UNIONs.
Topics Covered in This Chapter.
What Is a Union?
Writing Requests with UNION.
Using Simple SELECT Statements.
Combining Complex SELECT Statements.
Using UNION More Than Once.
Sorting a UNION.

Uses for UNION.
Sample Statements.
Problems for You to Solve.

11. Subqueries.
Topics Covered in This Chapter.
What Is a Subquery?
Row Subqueries.
Table Subqueries.
Scalar Subqueries.

Subqueries as Column Expressions.
Syntax.
An Introduction to Aggregate Functions--COUNT and MAX.

Subqueries as Filters.
Syntax.
Special Predicate Keywords for Subqueries.

Uses for Subqueries.
Column Expressions.
Filters.

Sample Statements.
Subqueries in Expressions.
Subqueries in Filters.

Problems for You to Solve.

IV. SUMMARIZING AND GROUPING DATA.


12. Summarizing Data.
Topics Covered in This Chapter.
Aggregate functions.
Counting Rows and Values with COUNT.
Computing a Total with SUM.
Calculating a Mean Value with AVG.
Finding the Largest Value with MAX.
Finding the Smallest Value with MIN.
Using More Than One Function.

Using Aggregate Functions in Filters.
Sample Statements.
Problems for You to Solve.

13. Grouping Data.
Topics Covered in This Chapter.
Why Group Data?
The GROUP BY Clause.
Syntax.
Mixing Columns and Expressions.
Using GROUP BY in a Subquery in a WHERE Clause.
Simulating a SELECT DISTINCT Statement.

"Some Restrictions Apply".
Column Restrictions.
Grouping on Expressions.
Uses for GROUP BY.

Sample Statements.
Problems for You to Solve.

14. Filtering Grouped Data.
Topics Covered in This Chapter.
A New Meaning of "Focus Groups".
When You Filter Makes A Difference.
Should You Filter in WHERE or in HAVING?
Avoiding the HAVING COUNT Trap.

Uses for HAVING.
Sample Statements.
Problems for You to Solve.

In Closing.

APPENDICES.

A. SQL Standard Diagrams.
B. Schema for the Sample Databases.
C. Recommended Reading References.
Index. 0201433362T04062001


Back to Top

商品描述(中文翻譯)

這是一本實用、實際操作、用平易近人的方式指導讀者如何使用SQL獲得結果的指南!本書不含不必要的術語,只提供真正的幫助和有用的例子!涵蓋了商業數據庫用戶最需要的每一個SQL技能,包括從多個表中提取數據、分組、總計、摘要等等。附帶的CD-ROM包含了五個真實世界的示例數據庫,供讀者使用本書中的示例查詢。

現在,對於數百萬初學者到中級數據庫用戶來說,有了一本實用、實際操作的SQL指南,他們迫切需要創建快速、準確、有效的查詢,無論他們是否接受過正式的數據庫培訓。作者首先介紹了關聯數據庫和SQL的基本概念。然後介紹了SQL的絕對基礎,包括SELECT語句、創建表達式和應用過濾器。接下來,他們介紹了解決數據庫用戶最常遇到的一個問題的技巧:同時從多個表中提取數據。本書詳細介紹了分組、總計和摘要數據的方法;使用SQL更新、插入和刪除數據;以及更多內容。在最後一部分中,Hernandez和Viescas介紹了一些“超越常規”的技巧,讓用戶能夠解決各種複雜的SQL問題。大多數章節都以示例問題、解決方案和結果集結束,這些都基於附帶的CD-ROM中包含的五個真實世界的數據庫。

Michael J. Hernandez是一位知名的關聯數據庫顧問,評價很高的Microsoft Access講師,也是位於西雅圖的DataTex Consulting Group的所有者。他是暢銷書《Database Design for Mere Mortals》的作者,書號為0-201-69471-9。John L. Viescas是Viescas Consulting, Inc.的總裁,該公司是一家受人尊敬的數據庫咨詢服務提供商。他是《Running Microsoft Access 97》和《Quick Reference Guide to SQL》的作者,被譽為“SQL的《Strunk and White》”。

目錄:
前言
前言和致謝詞
關於作者
引言
第一部分:關聯數據庫和SQL
第1章:什麼是“關聯”?
第2章:確保數據庫結構正確
第二部分:SQL的絕對基礎
第3章:SELECT語句
第4章:創建表達式
第5章:應用過濾器
第三部分:從多個表中提取數據
第6章:基本的多表查詢
第7章:進階的多表查詢
第8章:使用子查詢
第四部分:數據的分組、總計和摘要
第9章:分組數據
第10章:總計數據
第11章:摘要數據
第五部分:使用SQL更新、插入和刪除數據
第12章:更新數據
第13章:插入數據
第14章:刪除數據
第六部分:超越常規的SQL技巧
第15章:使用聯合和交集
第16章:使用外部連接
第17章:使用子查詢和派生表
第18章:使用全文搜索
第19章:使用遞歸查詢
第20章:使用游標
第21章:使用存儲過程和觸發器
第22章:使用動態SQL
第23章:使用元數據
第24章:使用SQL Server的XML功能
第25章:使用SQL Server的空間數據
第26章:使用SQL Server的分析服務
第27章:使用SQL Server的報表服務
第28章:使用SQL Server的集成服務
第29章:使用SQL Server的數據庫鏡像
第30章:使用SQL Server的數據庫快照
第31章:使用SQL Server的數據庫複製
第32章:使用SQL Server的數據庫快照
第33章:使用SQL Server的數據庫複製
第34章:使用SQL Server的數據庫快照
第35章:使用SQL Server的數據庫複製
第36章:使用SQL Server的數據庫快照
第37章:使用SQL Server的數據庫複製
第38章:使用SQL Server的數據庫快照
第39章:使用SQL Server的數據庫複製
第40章:使用SQL Server的數據庫快照
第41章:使用SQL Server的數據庫複製
第42章:使用SQL Server的數據庫快照
第43章:使用SQL Server的數據庫複製
第44章:使用SQL Server的數據庫快照
第45章:使用SQL Server的數據庫複製
第46章:使用SQL Server的數據庫快照
第47章:使用SQL Server的數據庫複製
第48章:使用SQL Server的數據庫快照
第49章:使用SQL Server的數據庫複製
第50章:使用SQL Server的數據庫快照
第51章:使用SQL Server的數據庫複製
第52章:使用SQL Server的數據庫快照
第53章:使用SQL Server的數據庫複製
第54章:使用SQL Server的數據庫快照
第55章:使用SQL Server的數據庫複製
第56章:使用SQL Server的數據庫快照
第57章:使用SQL Server的數據庫複製
第58章:使用SQL Server的數據庫快照
第59章:使用SQL Server的數據庫複製
第60章:使用SQL Server的數據庫快照
第61章:使用SQL Server的數據庫複製
第62章:使用SQL Server的數據庫快照
第63章:使用SQL Server的數據庫複製
第64章:使用SQL Server的數據庫快照
第65章:使用SQL Server的數據庫複製
第66章:使用SQL Server的數據庫快照
第67章:使用SQL Server的數據庫複製
第68章:使用SQL Server的數據庫快照
第69章:使用SQL Server的數據庫複製
第70章:使用SQL Server的數據庫快照
第71章:使用SQL Server的數據庫複製
第72章:使用SQL Server的數據庫快照
第73章:使用SQL Server的數據庫複製
第74章:使用SQL Server的數據庫快照
第75章:使用SQL Server的數據庫複製
第76章:使用SQL Server的數據庫快照
第77章:使用SQL Server的數據庫複製
第78章:使用SQL Server的數據庫快照
第79章:使用SQL Server的數據庫複製
第80章:使用SQL Server的數據庫快照
第81章:使用SQL Server的數據庫複製
第82章:使用SQL Server的數據庫快照
第83章:使用SQL Server的數據庫複製
第84章:使用SQL Server的數據庫快照
第85章:使用SQL Server的數據庫複製
第86章:使用SQL Server的數據庫快照
第87章:使用SQL Server的數據庫複製
第88章:使用SQL Server的數據庫快照
第89章:使用SQL Server的數據庫複製
第90章:使用SQL Server的數據庫快照
第91章:使用SQL Server的數據庫複製
第92章:使用SQL Server的數據庫快照
第93章:使用SQL Server的數據庫複製
第94章:使用SQL Server的數據庫快照
第95章:使用SQL Server的數據庫複製
第96章:使用SQL Server的數據庫快照
第97章:使用SQL Server的數據庫