empfehlenswert
Oracles SQL Implementation hat einige Besonderheiten zu bieten. Dies Buch konzentriert sich auf den SQL (DML) Teil und versucht nicht auch PL/SQL und Tuning abzudecken. Wer also wissen will, was schon mit SQL möglich ist, der ist mit diesem Buch bestens bedient.
Viele Oracle und/oder SQL Bücher begnügen sich damit die Syntax und vielleicht noch einige (meist triviale) Beispiele zu zeigen. Aus der Beschreibung:
It covers Oracle's vast library of built-in functions, the full range of Oracle SQL query-writing features, regular expression support, new aggregate and analytic functions, subqueries in the SELECT and WITH clauses, multiset union operators, enhanced support for hierarchical queries: leaf and loop detection, and the CONNECT_BY_ROOT operator, new partitioning methods (some introduced in Oracle9i Release 2), and the native XML datatype, XMLType.
Table of Contents
Preface
1. Introduction to SQL
What Is SQL?
A Brief History of SQL
A Simple Database
DML Statements
So Why Are There 17 More Chapters?
2. The WHERE Clause
Life Without WHERE
WHERE to the Rescue
WHERE Clause Evaluation
Conditions and Expressions
WHERE to Go from Here
3. Joins
What Is a Join Query?
Join Conditions
Types of Joins
Joins and Subqueries
DML Statements on a Join View
4. Group Operations
Aggregate Functions
The GROUP BY Clause
The HAVING Clause
Nested Group Operations
5. Subqueries
What Is a Subquery?
Noncorrelated Subqueries
Correlated Subqueries
Inline Views
Subquery Case Study: The Top N Performers
6. Handling Temporal Data
Time Zones
Temporal Data Types in Oracle
Literals of Temporal Types
Getting Temporal Data In and Out of a Database
Date and Time Formats
Manipulating Temporal Data
7. Set Operations
Set Operators
Precedence of Set Operators
Comparing Two Tables
Using NULLs in Compound Queries
Rules and Restrictions on Set Operations
8. Hierarchical Queries
Representing Hierarchical Information
Simple Hierarchy Operations
Oracle SQL Extensions
Complex Hierarchy Operations
Restrictions on Hierarchical Queries
Enhancements in Oracle Database 10g
9. DECODE and CASE
DECODE, NULLIF, NVL, and NVL2
The Case for CASE
DECODE and CASE Examples
10. Partitioning
Partitioning Concepts
Partitioning Tables
Partitioning Indexes
Partitioning Methods
Specifying Partitions
Partition Pruning
11. PL/SQL
What Is PL/SQL?
Procedures, Functions, and Packages
Calling Stored Functions from Queries
Restrictions on Calling PL/SQL from SQL
Stored Functions in DML Statements
The SQL Inside Your PL/SQL
12. Objects and Collections
Object Types
Collection Types
Collection Instantiation
Querying Collections
Collection Unnesting
Collection Functions
Comparing Collections
Manipulating Collections
Multilevel Collections
13. Advanced Group Operations
Multiple Summary Levels
Pushing the GROUPING Envelope
The GROUPING_ID and GROUP_ID Functions
14. Advanced Analytic SQL
Analytic SQL Overview
Ranking Functions
Windowing Functions
Reporting Functions
Summary
15. SQL Best Practices
Know When to Use Specific Constructs
Avoid Unnecessary Parsing
Consider Literal SQL for Decision-Support Systems
16. XML
What Is XML?
Storing XML Data
Generating XML Documents
Summary
17. Regular Expressions
Elementary Regular Expression Syntax
Advanced Function Options
Advanced Regular Expression Syntax
18. Model Queries
Basic Elements of a Model Query
Cell References
Rules
Iterative Models
Reference Models
Appendix: Oracle's Old Join Syntax
Index
O'Reilly-typisch, nichts zu beanstanden.
Dies Buch zeigt viele Oracle spezifische Erweiterungen von SQL. Hier sind Regular Expressions, XML, Model Queries zu nennen. Die Kapitel über die Zeitformate und das Jahr 0 Problem zeigen sehr schön, wo es üble Fussfallen geben kann. Die Beispiele mit den Pivot-Tabellen, können helfen, sich auf die schnelle ein paar Testdaten zu erzeugen.
Wer das Buch gelesen hat, wird nicht gleich immer auf PL/SQL zurückgreifen, wenn es einmal 'heikle' Queries zu bauen gilt. Mit 'normalem' SQL kann man auch sehr viel erreichen -- und das sieht man mit diesem Buch sehr deutlich.
Wer sich hin und wieder mit Oracle SQL Queries beschäftigt, sollte mindestens einmal in dies Buch gesehen haben. Es ist von Praktikern für Praktiker geschrieben.
Sanjay Mishra, Alan Beaulieu
2004 (2nd ed.), O'Reilly, ISBN 0-596-00632-2, 472 Seiten
Amazon: http://www.amazon.de/exec/obidos/ASIN/0596006322
Verlag: http://www.oreilly.com/catalog/0596006322/index.html
Jahr 0 Problem: http://www.orafaq.net/papers/dates_o.doc (Achtung Word!)
Weitere nette Artikel (z.B. Pivot Tabellen) hat Jonathan Gennik verfasst http://www.gennick.com/articles_etc.html
Ein lose Sammlung von SQL Tipps...
You can use a queryname everywhere in all the selects afterwards. It even brings performance gains as the query is executed only once as opposed to the previous case.
WITH queryname as (SELECT ... FROM ...) SELECT ... FROM ...;
The same can be achieved with a temporary table.
create global temporary table (...) on commit delete rows;
The temporary tables are purely memory based, meaning there is no performance drawbacks in using them. And they are session specific, meaning the data is not mixed between sessions.
Database, Oracle, SQL92
10-Apr-2005