Synopses & Reviews
The vast majority of Oracle SQL books discuss some syntax, provide the barest rudiments of using Oracle SQL, and perhaps include a few simple examples. It might be enough to pass a survey course, or give you some buzz words to drop in conversation with real Oracle DBAs. But if you use Oracle SQL on a regular basis, you want much more. You want to access the full power of SQL to write queries in an Oracle environment. You want a solid understanding of what's possible with Oracle SQL, creative techniques for writing effective and accurate queries, and the practical, hands-on information that leads to true mastery of the language. Simply put, you want useful, expert best practices that can be put to work immediately, not just non-vendor specific overview or theory.Updated to cover the latest version of Oracle, Oracle 10g, this edition of the highly regarded Mastering Oracle SQL has a stronger focus on technique and on Oracle's implementation of SQL than any other book on the market. 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.Mastering Oracle SQL, 2nd Edition fills the gap between the sometimes spotty vendor documentation, and other books on SQL that just don't explore the full depth of what is possible with Oracle-specific SQL. For those who want to harness the untapped (and often overlooked) power of Oracle SQL, this essential guide for putting Oracle SQL to work will prove invaluable.
- Updated to cover the latest version of Oracle, Oracle 10g
- Includes a unified example dataset that ensures the data underlying the examples do not differ from chapter to chapter
- Features stronger focus on technique and on Oracle's implementation of SQL than any other book on the market
About the Author
is a certified Oracle database administrator with more than ten years of IT experience. He has been involved in the design, architecture, and implementation of many mission-critical and decision support databases. He has worked extensively in the areas of database architecture, database management, backup / recovery, performance tuning, Oracle Parallel Server, and parallel execution. He has a Bachelor of Science degree in Electrical Engineering, and a Master of Engineering degree in Systems Science and Automation. He is the coauthor of Oracle Parallel Processing
and Oracle SQL Loader: The Definitive Guide
(both published by O'Reilly & Associates). Presently, he works as a database architect at Dallas Based i2 Technologies, and can be reached at email@example.com.
Alan Beaulieu has been designing, building, and implementing custom database applications for over 13 years. He currently runs his own consulting company that specializes in designing Oracle databases and supporting services in the fields of Financial Services and Telecommunications. In building large databases for both OLTP and OLAP environments, Alan utilizes such Oracle features as Parallel Query, Partitioning, and Parallel Server. Alan has a Bachelor of Science degree in Operations Research from the Cornell University School of Engineering. He lives in Massachusetts with his wife and two daughters and can be reached at firstname.lastname@example.org.
Table of Contents
Preface; Why We Wrote This Book; What's New in Oracle SQL?; Objectives of This Book; Audience for This Book; Platform and Version; Structure of This Book; Conventions Used in This Book; Using Code Examples; Comments and Questions; Acknowledgments; Chapter 1: Introduction to SQL; 1.1 What Is SQL?; 1.2 A Brief History of SQL; 1.3 A Simple Database; 1.4 DML Statements; 1.5 So Why Are There 17 More Chapters?; Chapter 2: The WHERE Clause; 2.1 Life Without WHERE; 2.2 WHERE to the Rescue; 2.3 WHERE Clause Evaluation; 2.4 Conditions and Expressions; 2.5 WHERE to Go from Here; Chapter 3: Joins; 3.1 What Is a Join Query?; 3.2 Join Conditions; 3.3 Types of Joins; 3.4 Joins and Subqueries; 3.5 DML Statements on a Join View; Chapter 4: Group Operations; 4.1 Aggregate Functions; 4.2 The GROUP BY Clause; 4.3 The HAVING Clause; 4.4 Nested Group Operations; Chapter 5: Subqueries; 5.1 What Is a Subquery?; 5.2 Noncorrelated Subqueries; 5.3 Correlated Subqueries; 5.4 Inline Views; 5.5 Subquery Case Study: The Top N Performers; Chapter 6: Handling Temporal Data; 6.1 Time Zones; 6.2 Temporal Data Types in Oracle; 6.3 Literals of Temporal Types; 6.4 Getting Temporal Data In and Out of a Database; 6.5 Date and Time Formats; 6.6 Manipulating Temporal Data; Chapter 7: Set Operations; 7.1 Set Operators; 7.2 Precedence of Set Operators; 7.3 Comparing Two Tables; 7.4 Using NULLs in Compound Queries; 7.5 Rules and Restrictions on Set Operations; Chapter 8: Hierarchical Queries; 8.1 Representing Hierarchical Information; 8.2 Simple Hierarchy Operations; 8.3 Oracle SQL Extensions; 8.4 Complex Hierarchy Operations; 8.5 Restrictions on Hierarchical Queries; 8.6 Enhancements in Oracle Database 10g; Chapter 9: DECODE and CASE; 9.1 DECODE, NULLIF, NVL, and NVL2; 9.2 The Case for CASE; 9.3 DECODE and CASE Examples; Chapter 10: Partitioning; 10.1 Partitioning Concepts; 10.2 Partitioning Tables; 10.3 Partitioning Indexes; 10.4 Partitioning Methods; 10.5 Specifying Partitions; 10.6 Partition Pruning; Chapter 11: PL/SQL; 11.1 What Is PL/SQL?; 11.2 Procedures, Functions, and Packages; 11.3 Calling Stored Functions from Queries; 11.4 Restrictions on Calling PL/SQL from SQL; 11.5 Stored Functions in DML Statements; 11.6 The SQL Inside Your PL/SQL; Chapter 12: Objects and Collections; 12.1 Object Types; 12.2 Collection Types; 12.3 Collection Instantiation; 12.4 Querying Collections; 12.5 Collection Unnesting; 12.6 Collection Functions; 12.7 Comparing Collections; 12.8 Manipulating Collections; 12.9 Multilevel Collections; Chapter 13: Advanced Group Operations; 13.1 Multiple Summary Levels; 13.2 Pushing the GROUPING Envelope; 13.3 The GROUPING_ID and GROUP_ID Functions; Chapter 14: Advanced Analytic SQL; 14.1 Analytic SQL Overview; 14.2 Ranking Functions; 14.3 Windowing Functions; 14.4 Reporting Functions; 14.5 Summary; Chapter 15: SQL Best Practices; 15.1 Know When to Use Specific Constructs; 15.2 Avoid Unnecessary Parsing; 15.3 Consider Literal SQL for Decision-Support Systems; Chapter 16: XML; 16.1 What Is XML?; 16.2 Storing XML Data; 16.3 Generating XML Documents; 16.4 Summary; Chapter 17: Regular Expressions; 17.1 Elementary Regular Expression Syntax; 17.2 Advanced Function Options; 17.3 Advanced Regular Expression Syntax; Chapter 18: Model Queries; 18.1 Basic Elements of a Model Query; 18.2 Cell References; 18.3 Rules; 18.4 Iterative Models; 18.5 Reference Models; Appendix A: Oracle's Old Join Syntax; A.1 Old Inner Join Syntax; A.2 Old Outer Join Syntax; A.3 Advantages of the New Join Syntax; Colophon;