Preface to the Third Edition
If you have had any contact with a relational database, then it is very likely that you have seen the letters “SQL.” SQL (Structured Query Language) is a computer language designed to manipulate relational databases. You can use it to define a database's structure, to modify data, and to retrieve data.
This book has been written to give you an in-depth introduction to using SQL, providing a gentle but complete approach to learning the language. You will learn not only SQL syntax, but also how SQL works. Understanding the “how” as well as the “what” will help you create SQL statements that execute as quickly as possible.
The elements of the SQL language covered in the first four parts of this book are based on those parts of the SQL standard that are for use with pure relational databases. Part V covers two non-relational extensions (XML and object-relational capabilities) that have been part of SQL since 2003. Virtually all database management systems that support SQL will provide the bulk of what you will find in Parts I–IV; implementations of the features in Part V are less common and tend to vary from the standard.
There have been some substantial enhancements to the SQL standard since the second edition of this book, both in the relational core features and the non-relational features. These features have been integrated throughout this third edition.
Organization of This Book
The five parts of this book take you from theory to practice:
◊ Part I: The theoretical material underlying relational databases and SQL has been moved into two chapters at the beginning of the book. In previous editions, the material in Chapter 2 (relational algebra) was scattered throughout the book. This organization should make it easier to find. The third chapter in Part I provides an overview of SQL environments.
◊ Part II: Part II covers interactive SQL retrieval. At first, this might seem backwards. Why discuss retrieving data before creating a database and getting data into that database? There is actually a very good reason for this.
SQL presents someone trying to learn the language with a bit of a catch-22. You need to know how to retrieve data before you can modify it, because modifying data means finding the data you want to change. On the other hand, you need to be able to create a database and enter some data before you have some data on which you can perform retrievals. Like Yossarian trying to meet with Major Major, it doesn't seem that you can win!
The best alternative is to have someone who knows how to do it create a sample database and load it with data for you. Then you can learn to query that database and carry those techniques over to modifying data. At that point, you'll have an understanding of SQL basics and will be ready to learn to create databases.
Part III: Part III discusses creating and managing database structure. It also covers non-data elements in the database environment, such as managing users/ user accounts and transaction control.
◊ Part IV: When SQL-based database environments are being developed, programmers and database administrators do a lot of work using a command-line interface. There are, however, at least two reasons why SQL programming is very common:
○ The typical end-user should not (or cannot) work directly from the SQL command line. We therefore create application programs to isolate them from direct interaction with the SQL command processor by writing application programs for them to use.
○ In many cases, there are actions the database should perform in specific circumstances. We don't want to require users to remember to do these actions, so we write blocks of program code that are stored within the database to be executed automatically at the appropriate time.
Part IV introduces several techniques for SQL programming: embedded SQL (using a high-level host language), dynamic SQL, and triggers/stored procedures. These chapters teach you syntax of SQL programming constructs, but do not teach programming.
◊ Part V: Part V discusses the non-relational extensions that have been added to the SQL standard: XML and object-relational capabilities. Just as Chapter 1 presents a brief introduction to the relational data model, Chapter 18 covers object-oriented concepts, including the differences between pure object-oriented databases and object-relational databases. Chapter 19 then looks at SQL's object-relational features.
Database Software
Much of today's commercial database software is very expensive and requires expensive hardware on which to run. If you are looking for a database management system for your own use, you needn't purchase anything should you choose not to. There are at least two open-source products that will run on reasonable hardware configurations: mySQL (http://www.mysql.com) and PostgreSQL (http://www.postgresql.org). Both are certainly used in commercial settings, but can also function well as learning environments. Distributions are available for Windows, Linux, and Mac OS X.
The SQL commands to create the sample database used in the first four parts of this book and the SQL commands to insert data into those tables can be downloaded from the Morgan Kaufmann Web site.
Teaching Materials
If you are using this book as a college text (perhaps jointly with its companion volume, Relational Database Design and Implementation Clearly Explained), you can find teaching support materials on the Morgan Kaufmann Web site. These include a sample syllabus, assignments (and where appropriate, solutions), a project description, and exams.
Acknowledgements
Although an author spends a lot of time alone in front of the computer, no book can come into being without the cooperation and hard work of many people. It may be my name on the cover, but without the people at Morgan Kaufmann, you wouldn't be holding this book right now.
First I'd like to thank the editorial staff, Rick Adams (Senior Acquisitions Editor) and Heather Scherer (Assistant Editor). You're a joy to work with (as always). Second, I am forever grateful for the production staff, who have done everything they can to make my life easier and to produce a great volume: Anne McGee (Project Manager), Joanne Blank (Designer), and Carol Lewis (Copyeditor).
I also can't forget my support staff: my mother, my son, and the four fur kids. (Now, if the kittens could just distinguish between my leg and a scratching post, my world would be at peace.)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.109.205