Practical SQL : The Sequel
by Judith S. BowmanView All Available Formats & Editions
For those who are working with SQL systems--or preparing to do so--this book offers information organized by use rather than by feature. Therefore, readers can turn to specific business problems and learn how to solve them with the appropriate SQL features. In particular, the book focuses on the real-world challenges of dealing with legacy systems,…
See more details below
Overview
For those who are working with SQL systems--or preparing to do so--this book offers information organized by use rather than by feature. Therefore, readers can turn to specific business problems and learn how to solve them with the appropriate SQL features. In particular, the book focuses on the real-world challenges of dealing with legacy systems, inherited problematic code, dirty data, and query tuning for better performance.
The following important topics are addressed:
- Finding and fixing dirty data with LIKE, BETWEEN, and LOCATE
- Managing multiples and other complex data problems with ROWID, SIMILAR, GROUP BY, and HAVING
- Handling the multiple display formats of dates
- Translating values to expand compressed codes with CASE, DECODE, point functions, UNION, and subqueries
- Manipulating numbers, including using auto-numbering mechanisms, finding the high value, locating every Nth, and more.
- Tuning queries for enhanced performance, focusing on indexes and the optimizer
- Comparing vendors' system catalogs and system functions
- Using SQL to generate SQL for cleanup and permission scripts as well as creating test data
A business-based working database serves as a running example throughout the book. It provides the context for numerous code samples, all of which are tested on multiple systems, including Adaptive Server Anywhere, Oracle, Informix, Microsoft SQL Server, and Sybase Adaptive Server Enterprise. The accompanying CD-ROM contains the full sample database as well as Adaptive Server Anywhere.
0201616386B04062001
Editorial Reviews
Product Details
- ISBN-13:
- 9780201616385
- Publisher:
- Pearson Education
- Publication date:
- 11/20/2000
- Edition description:
- BK&CD-ROM
- Pages:
- 336
- Product dimensions:
- 7.37(w) x 9.18(h) x 0.95(d)
Read an Excerpt
PREFACE:
Why This Book?
SQL (pronounced "sequel") is the premier language for relational database management systems (RDBMSs). If you work with databases, you need to know it. This book assumes that you know the fundamentals and want to move on.
There are lots of books on learning basic SQL, and more are being published all the time. You can find excellent general tutorials, references, and vendor specific manuals. Classes and videos abound, too. Unfortunately, most working database applications don't use basic SQL. After you read an introductory book or get some training, you're thrown into a world of complex code and told to "maintain thisdon't change it, just keep it working" or "fix this." The lines you look at have only a passing similarity to the things you learned from that great book or in class. How do you make the transition?
This book aims to help you over the classroom-to-reality hump in five ways.
- Information is organized by use, rather than by feature.
- The text is code-heavy, and all the examples use the same database.
- Every example was tested on multiple systemsAdaptive Server Anywhere (on the CD), Oracle, Informix, Microsoft SQL Server, and Sybase Adaptive Server Enterprise.
- Legacy systems and inherited problems are given special attention.
- SQL tuning notes help you avoid bad performance.
Who this Book isFor
This book is for you, the SQL user who understands the basics and wants to know more.
- You've been using a GUI report writer, and you're trying to do things it can't; or you'd like to stop being at the mercy of the system guys by giving them clearer instructions or doing more of the coding yourself.
- Your opportunities for practice are limited and the code templates you find turn out to be based on a specific system or on a theoretical model not really applicable to your situation.
- The SQL dialect you're using on the job is different from the one you learned in class, or you are working with multiple systems.
- You're supporting code some long gone employee wrote, which doesn't seem to work right and is full of stuff you've never seen before.
- Some of the queries you see seem more complicated than necessary, and you wonder if you could do anything to improve performance. This book will help you tackle new assignments, read inherited code, and make improvements to it. Start by looking up a problem. Run the code, then modify a few things to make sure you understand how it works. Try applying the method to similar situations in your own database.
Contents
You don't need to read the book from start to endyou can jump in at any point. If a topic is treated in one chapter and mentioned in another, the shorter treatment refers to the longer one.
Chapters
Here are the chapters and their contents.
- "Introduction" assumes that you've already started your SQL career. It explains the book approach, organization, and conventions, and lists the SQL systems used. It provides a brief summary of the sample database.
- "Handling Dirty Data" explores SQL functions and predicates, with suggestions on using them for finding and fixing dirty datadata with case or space or size problems or data containing embedded garbage. You get
Appendices
The appendices contain supplementary materials.
- "Understanding the Sample DB: MSDPN" provides information about the sample database, including hard copy of the scripts that create the database for the five test systems. These scripts are on the CD in electronic form. Finally, there are notes on transaction commandsSQL statements you can use to cancel data modifications (if you plan ahead) and on deleting data or dropping tables, should you need to start over again.
- "Comparing Datatypes and Functions" is all the little SQL dialect variant charts merged into a big one for your convenience. Here you'll see datatype information and tables summarizing variations in character, number, date, convert, conditional, tuning, and system functions. There is also a table on outer join syntax and notes on environment.
- "Using Resources" includes books, Web sites, and newsgroups you might find interesting.