Practical SQL The Sequel
暫譯: 實用 SQL:續篇

Judith S. Bowman

  • 出版商: Addison Wesley
  • 出版日期: 2000-12-15
  • 定價: $1,360
  • 售價: 6.0$816
  • 語言: 英文
  • 頁數: 352
  • 裝訂: Paperback
  • ISBN: 0201616386
  • ISBN-13: 9780201616385
  • 相關分類: SQL
  • 立即出貨(限量) (庫存=3)

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

相關主題

商品描述


Description

The business problem-solving sequel to the best selling, The Practical SQL Handbook.

  • Built around real business problems and solutions, not SQL features.
  • The perfect "next step" for SQL-literate professionals ready to go far beyond the basics.
  • CD-ROM: real-world example databases and complete Sybase Adaptive Server Anywhere database system to run them on.
In the real world, the SQL challenges you're likely to face go far beyond the "generic" basics taught by most books. Whether you're maintaining existing SQL code, enhancing it, or writing entirely new applications, you need to review all kinds of SQL, understand what's going on "under the hood," and translate SQL's features into real tools for solving problems. In Practical SQL: The Sequel, Judith Bowman builds on her best-selling Practical SQL, delivering techniques and code you can use right now to write queries that solve even your most complex problems. Organized around categories of problems -- not abstract SQL features -- Practical SQL: The Sequel includes extensive proven code that has been tested against multiple leading RDBMS systems. Bowman offers detailed solutions for controlling data displays using character, number, and date functions; cleaning dirty data; and translating values using a variety of methods. There's a full chapter on managing multiples. Finally, Bowman presents numbering solutions, and techniques for tuning queries. An extensive sample database is included, along with a single source reference containing information about leading SQL dialect variants. For every intermediate-to-advanced level database and business professional who wants to use SQL more effectively.

Judith S. Bowman has been involved in databases since the early 1980s at Sybase and other database companies, in publications, sales, technical marketing, product marketing, and engineering. She has been an independent database consultant since 1994. Bowman is lead author of The Practical SQL Handbook (Addison Wesley), 0-201-44787-8.

Back to Top


Table Of Contents

List of Tables.
List of Figures.
Acknowledgments.
1. Introduction.
In This Chapter.
Why This Book?
Use, Not Feature.
Lots of Examples.
Multiple Systems.
Legacy.
Tuning.

Who This Book Is For.
Contents.
Chapters.
Appendices.

Speaking Multiple SQLs.
SQL Engines.
SQL Dialects.

Following Conventions.
Text.
Code.

Understanding the MSDPN Database.
Table Details.
Customer.
Supplier.
Product.
Ordermaster.
Orderdetail.
Employee.

Using the Examples.
Summary.

2. Handling Dirty Data.
In This Chapter.
Dirty Data.
Case.
Sort Order.
UPPER and LOWER in Searches.
UPPER and LOWER in UPDATE.
UPPER and LOWER with Dates.
INITCAP.

Space.
Removing Spaces.
Additional Features.

Size.
Actual Size.
Defined Size.

LIKE.
Quoting Wildcards with ESCAPE.
LIKE Variants.
Datatypes and LIKE.

Position of Expression in Expression.
How LOCATE Works.
Using LOCATE Functions.

Sounds Like.
BETWEEN.
Dealing with Dates.
Converting Dates (and Other Datatypes).
Doing Math on Dates.
Finding Dates.

Summary.

3. Translating Values.
In This Chapter.
Why Translate?
CASE/DECODE.
CASE.
DECODE.
CASE/DECODE Variations.

Translating NULL.
COALESCE/ISNULL/NVL.
Finding the First Non-NULL: COALESCE.
NULLIF.

Point Functions.
Getting CASE Effects from Functions and Column Values.
Getting CASE Effects from Multiple Functions.

UNION.
How UNION Works.
UNION and NULL.
UNION Problems?

Joins and Outer Joins.
Joins and NULL Values.
Outer Joins.

Subqueries.
Subqueries and Displays.
Embedded Correlated Subqueries.
Correlated and Non-Correlated Subqueries.
Another Conditional Expression: TRANSLATE.

Summary.

4. Managing Multiples.
In This Chapter.
What's the Issue with Multiples?
Duplicates.
Duplicates and a Holding Table.
Using ROWID to Remove Duplicates.

Near Duplicates.
Self Join.
Unequal Joins.
SIMILAR.

Locating Disconnected Rows.
Using Outer Joins.
Using NOT IN Subqueries.
Using MINUS.

Counting Items.
Grouping by a Subset.
Locating the Critical Element.
Groups and Outer Joins.

Figuring Distribution.
Checking Detail against Master.
Two Products Together?
HAVING.

Summary.

5. Navigating Numbers.
In This Chapter.
Auto-Numbering.
ASA: Default.
Transact-SQL: Column Property.
Microsoft SQL Server: IDENTITY (start, increment).
Sybase Adaptive Server Enterprise: IDENTITY.
Oracle: CREATE SEQUENCE.
Informix: SERIAL Datatype.
Associated Issues.

Finding the High Value.
GROUP BY, COUNT, HAVING MAX (COUNT).
FROM Subquery.
Row Counts of Various Sorts.

Row Numbers.
System Numbers.
You Make the Numbers.

Top N: Six Approaches.
1: Row Limits and ORDER BY.
2: Row Numbers and HAVING.
3: Subquery.
4: Nested Subqueries.
5: Aggregates & Many Copies.
6: Cursors.

Finding Every Nth.
What Modulo Is.
Modulo in WHERE and HAVING.
Back to Nth Row.

Running Total.
Summary.

6. Tuning Queries.
In This Chapter.
Perform, #%&#@!
The Basic Problem.
The Optimizer and Tools for Understanding It.
Getting Information on Indexes.
Checking the Optimizer.
SQL Conventions.

WHERE Clause.
Why a Table Scan?
Data Distribution Statistics.
Disabling an Index with a Bad WHERE.
Comparing Columns in the Same Table.
Using Non-Selective Indexes.
Doing Math on a Column.
Using Functions.
Finding Ranges with BETWEEN.
Matching with LIKE.
Comparing to NULL.
Negating with NOT.
Converting Values.
Using OR.
Finding Sets of Values with IN.
Using Multi-Column Indexes.

Covering Indexes.
Joining Columns.
Sorting.
DISTINCT.
UNION.
WHERE.

HAVING and WHERE.
Views.
Forcing Indexes.
Summary.
Asking Performance Questions.
USING SQL TO WRITE SQL.

In This Chapter.
Systematically Speaking.
System Catalogs.
Listing System Catalogs.
Writing Queries Using System Catalogs.

System Functions.
Getting Administrative Information.
Finding Today's Date.

Writing SQL with SQL.
GRANTing Permissions.
Removing Junk Objects.

Creating Test Data.
Summary.

Appendix A. Understanding the Sample.
In This Appendix.
MegaSysDataProNet Co.
Collecting the CREATE Scripts.
Adaptive Server Anywhere.
Sybase Adaptive Server Enterprise.
Microsoft SQL Server.
Oracle.
Informix.

Explaining the INSERT Scripts.
INSERT INTO customer.
INSERT INTO supplier.
INSERT INTO product.
INSERT INTO employee.
INSERT INTO ordermaster.
INSERT INTO orderdetail.

Experimenting and Transaction Management.
Removing Data and Objects: DROP and DELETE Commands.
Remove Database.
DROP Commands.
DELETE FROM Command.

Summary.

Appendix B. Comparing Datatypes and Functions.
In This Appendix.
Comparatively Speaking.
Datatype Comparison.
Function Comparison.
Character (String) Functions.
Number Functions.
Date Functions.
Conditional Functions.
Sequential Number Methods.
Row Number and Row ID Methods.
Other Functions.
Tuning Functions.
System Functions.

Join Syntax Comparison.
Notes on Environment and Display.
Summary.

Appendix C. Using Resources.
In This Appendix.
Books.
General.
Informix.
Microsoft SQL Server.
mSQL/MySQL.
Oracle.
Sybase.
Transact-SQL.

Web Sites.
Database Vendors.
Other Offerings.

Newsgroups.

Index. 0201616386T04062001


Back to Top

商品描述(中文翻譯)

描述
《實用 SQL 手冊》的商業問題解決續集。
- 以真實的商業問題和解決方案為基礎,而非 SQL 特性。
- 對於準備超越基礎的 SQL 熟練專業人士來說,這是完美的「下一步」。
- CD-ROM:真實世界的範例資料庫和完整的 Sybase Adaptive Server Anywhere 資料庫系統以供運行。

在現實世界中,您可能面臨的 SQL 挑戰遠超過大多數書籍所教授的「通用」基礎知識。無論您是在維護現有的 SQL 代碼、增強它,還是編寫全新的應用程式,您都需要檢視各種 SQL,了解「底層」發生了什麼,並將 SQL 的特性轉化為解決問題的實際工具。在《實用 SQL:續集》中,Judith Bowman 在她的暢銷書《實用 SQL》的基礎上,提供了您現在可以使用的技術和代碼,以編寫能解決您最複雜問題的查詢。該書圍繞問題類別組織,而非抽象的 SQL 特性,《實用 SQL:續集》包含了經過多個領先 RDBMS 系統測試的廣泛驗證代碼。Bowman 提供了使用字符、數字和日期函數控制數據顯示的詳細解決方案;清理髒數據;以及使用各種方法轉換值。還有一整章專門講述管理多重項目。最後,Bowman 提出了編號解決方案和調整查詢的技術。書中包含了一個廣泛的範例資料庫,以及一個包含主要 SQL 方言變體信息的單一來源參考。適合每位希望更有效使用 SQL 的中級至高級資料庫和商業專業人士。

Judith S. Bowman 自 1980 年代初期以來一直參與資料庫工作,曾在 Sybase 和其他資料庫公司從事出版、銷售、技術行銷、產品行銷和工程。自 1994 年以來,她一直是一名獨立的資料庫顧問。Bowman 是《實用 SQL 手冊》(Addison Wesley)的主編,ISBN 0-201-44787-8。

目錄
- 表格列表
- 圖表列表
- 感謝詞
- 1. 介紹
- 本章內容
- 為什麼選擇這本書?
- 使用,而非特性
- 大量範例
- 多個系統
- 遺留
- 調整
- 本書適合誰
- 內容
- 章節
- 附錄
- 使用多種 SQL
- SQL 引擎
- SQL 方言
- 遵循慣例
- 文字
- 代碼
- 理解 MSDPN 資料庫
- 表格詳情
- 客戶
- 供應商
- 產品
- 訂單主檔
- 訂單明細
- 員工
- 使用範例
- 總結
- 2. 處理髒數據
- 本章內容
- 髒數據
- 案例
- 排序順序
- 搜尋中的 UPPER 和 LOWER
- 更新中的 UPPER 和 LOWER
- 日期中的 UPPER 和 LOWER
- INITCAP
- 空格
- 移除空格
- 附加特性
- 大小
- 實際大小
- 定義大小
- LIKE
- 使用 ESCAPE 引號通配符
- LIKE 變體
- 數據類型和 LIKE
- 表達式在表達式中的位置
- LOCATE 的工作原理
- 使用 LOCATE 函數
- 聽起來像
- BETWEEN
- 處理日期
- 轉換日期(及其他數據類型)
- 對日期進行數學運算
- 查找日期
- 總結
- 3. 翻譯值
- 本章內容
- 為什麼翻譯?
- CASE/DECODE
- CASE
- DECODE
- CASE/DECODE 變體
- 翻譯 NULL
- COALESCE/ISNULL/NVL
- 查找第一個非 NULL:COALESCE
- NULLIF
- 點函數
- 從函數和列值獲取 CASE 效果
- 從多個函數獲取 CASE 效果
- UNION
- UNION 的工作原理
- UNION 和 NULL
- UNION 問題?
- 連接和外連接
- 連接和 NULL 值
- 外連接
- 子查詢
- 子查詢和顯示
- 嵌入的相關子查詢
- 相關和非相關子查詢
- 另一個條件表達式:TRANSLATE
- 總結
- 4. 管理多重項目
- 本章內容
- 多重項目的問題是什麼?
- 重複項
- 重複項和暫存表
- 使用 ROWID 移除重複項
- 近似重複項
- 自我連接
- 不等連接
- SIMILAR
- 定位斷開的行
- 使用外連接
- 使用 NOT IN 子查詢
- 使用 MINUS
- 計算項目
- 按子集分組
- 定位關鍵元素
- 組和外連接
- 計算分佈
- 檢查明細與主檔
- 兩個產品一起?
- HAVING
- 總結
- 5. 瀏覽數字
- 本章內容
- 自動編號
- ASA:預設
- Transact-SQL:列屬性
- Microsoft SQL Server:IDENTITY(起始,增量)
- Sybase Adaptive Server Enterprise:IDENTITY
- Oracle:CREATE SEQUENCE
- Informix:SERIAL 數據類型
- 相關問題
- 查找高值
- GROUP BY、COUNT、HAVING MAX(COUNT)
- FROM 子查詢
- 各種排序的行計數
- 行號
- 系統號碼
- 您創建數字
- Top N:六種方法
- 1:行限制和 ORDER BY
- 2:行號和 HAVING
- 3:子查詢
- 4:嵌套子查詢
- 5:聚合和多個副本
- 6:游標
- 查找每個 Nth
- 模數是什麼
- 在 WHERE 和 HAVING 中的模數
- 返回 Nth 行
- 累計總和
- 總結
- 6. 調整查詢
- 本章內容
- 性能,#%@!
- 基本問題
- 優化器及其理解工具
- 獲取索引信息
- 檢查優化器
- SQL 慣例
- WHERE 子句
- 為什麼要進行表掃描?
- 數據分佈統計
- 使用不良 WHERE 禁用索引
- 比較同一表中的列
- 使用非選擇性索引
- 對列進行數學運算
- 使用函數
- 使用 BETWEEN 查找範圍
- 使用 LIKE 匹配
- 與 NULL 比較
- 使用 NOT 取反
- 轉換值
- 使用 OR
- 使用 IN 查找值集
- 使用多列索引
- 覆蓋索引
- 連接列
- 排序
- DISTINCT
- UNION
- WHERE
- HAVING 和 WHERE
- 視圖
- 強制使用索引
- 總結
- 提出性能問題
- 使用 SQL 編寫 SQL
- 本章內容
- 系統性地講
- 系統目錄
- 列出系統目錄
- 使用系統目錄編寫查詢
- 系統函數
- 獲取管理信息
- 查找今天的日期
- 使用 SQL 編寫 SQL
- GRANT 權限
- 移除垃圾對象
- 創建測試數據
- 總結
附錄 A. 理解範例
- 本附錄內容
- MegaSysDataProNet 公司
- 收集 CREATE 腳本
- Adaptive Server Anywhere
- Sybase Adaptive Server Enterprise
- Microsoft SQL Server
- Oracle
- Informix
- 解釋 INSERT 腳本
- INSERT INTO customer
- INSERT INTO supplier
- INSERT INTO product
- INSERT INTO employee
- INSERT INTO ordermaster
- INSERT INTO orderdetail
- 實驗和事務管理
- 移除數據和對象:DROP 和 DELETE 命令
- 移除資料庫
- DROP 命令
- DELETE FROM 命令
- 總結
附錄 B. 比較數據類型和函數
- 本附錄內容
- 相對而言
- 數據類型比較
- 函數比較
- 字符(字符串)函數
- 數字函數
- 日期函數
- 條件函數
- 序列號方法
- 行號和行 ID 方法
- 其他函數
- 調整函數
- 系統函數
- 連接語法比較
- 環境和顯示的註釋
- 總結
附錄 C. 使用資源
- 本附錄內容
- 書籍
- 一般
- Informix
- Microsoft SQL Server
- mSQL/MySQL
- Oracle
- Sybase
- Transact-SQL
- 網站
- 資料庫供應商
- 其他產品
- 新聞組
索引 0201616386T04062001