sql and relational theory

446 343 0
sql and relational theory

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... it relational The sad truth is, SQL departs from relational theory in all too many ways; duplicate rows and nulls are two obvious examples, but they’re not the only ones As a consequence, the language gives you rope to hang yourself with, as it were So if you don’t want to hang yourself, you need to understand relational theory (what it is and why); you need to know about SQL s departures from that theory; ... hope of writing SQL code that you can be sure is accurate, therefore—meaning it does exactly what it’s supposed to do, no more and no less—you must follow some appropriate discipline And it’s the thesis of this book that using SQL relationally is the discipline you need But what does this mean? Isn’t SQL relational anyway? Well, it’s true that SQL is the standard language for use with relational databases—but... about SQL; but and I apologize for the possibly offensive tone here─if your knowledge of the relational model derives only from your knowledge of SQL, then I’m afraid you won’t know the relational model as well as you should, and you’ll probably know “some things that ain’t so.” I can’t say it too strongly: SQL and the relational model aren’t the same thing Here by way of illustration are some relational. .. the time of writing is SQL: 2008 (a formal reference for which can be found in Appendix G); the previous version was SQL: 2003, the one before that was SQL: 1999, and the one before that was SQL: 1992 Most of the SQL features discussed in this book were present in SQL: 1992, and often in even earlier versions 3 These particular limitations were added in SQL: 2003; they didn’t apply to SQL: 1992, which is where... opinion, SQL is such a difficult language that it can be far from obvious how to use it without violating relational principles I therefore decided to expand the original book to include explicit, concrete advice on exactly that issue (how to use SQL relationally, I mean) So my aim in the present book is still the same as before—I want to help database practitioners understand relational theory in depth and. .. about SQL s departures from that theory; and you need to know how to avoid the problems they can cause In a word, you need to use SQL relationally Then you can behave as if SQL truly were relational, and you can enjoy the benefits of working with what is, in effect, a truly relational system Now, a book like this wouldn’t be needed if everyone was using SQL relationally already—but they aren’t On the... least one SQL product However, I don’t assume you have a deep knowledge of relational theory as such (though I do hope you understand that the relational model is a good thing in general, and adherence to it wherever possible is a desirable goal) In order to avoid misunderstandings, therefore, I’ll be describing various features of the relational model in detail, as well as showing how to use SQL to conform... of tuples, and sets in mathematics don’t contain duplicate elements Now, SQL fails here, as I’m sure you know: SQL tables are allowed to contain duplicate rows and thus aren’t relations, in general Please understand, therefore, that throughout this book I always use the term “relation” to mean a relation─without duplicate tuples, by definition and not an SQL table Please understand too that relational. .. regarding features of SQL or the relational model or both (It deliberately has little to say on topics that aren’t particularly relational; for example, there isn’t much on transactions.) Throughout, I’ve tried to make it clear when the discussions apply to SQL specifically, when they apply to the relational model specifically, and when they apply to both I should emphasize, however, that the SQL discussions... usually includes the title, author, publisher, and ISBN For example: SQL and Relational Theory, Second Edition, by C.J Date (O’Reilly) Copyright 2012 C.J Date, 9781449316402.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com Comments and Questions Please address comments and questions concerning this book to the . alt="" SQL and Relational Theory How to Write Accurate SQL Code SECOND EDITION C. J. Date sql_ final.pdf 1 12/8/11 2:33:04 PM SQL and Relational Theory: How to Write Accurate SQL Code. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. SQL and Relational Theory: How to Write Accurate SQL Code and related. exercises, and answers have been expanded and improved in various respects; and the treatment of SQL has been upgraded to cover recent changes to the SQL standard. A variety of corrections and numerous

Ngày đăng: 05/05/2014, 12:34

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Preface to the First Edition

  • Preface to the Second Edition

  • Chapter 1: Setting the Scene

  • Chapter 2: Types and Domains

  • Chapter 3: Tuples and Relations, Rows and Tables

  • Chapter 4: No Duplicates, No Nulls

  • Chapter 5: Base Relvars, Base Tables

  • Chapter 6: SQL and Relational Algebra I: The Original Operators

  • Chapter 7: SQL and Relational Algebra II: Additional Operators

  • Chapter 8: SQL and Constraints

  • Chapter 9: SQL and Views

  • Chapter 10: SQL and Logic

  • Chapter 11: Using Logic to Formulate SQL Expressions

  • Chapter 12: Miscellaneous SQL Topics

  • Appendix A: The Relational Model

  • Appendix B: SQL Departures from the Relational Model

  • Appendix C: A Relational Approach to Missing Information

  • Appendix D: A Tutorial D Grammar

  • Appendix E: Summary of Recommendations

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan