1. Trang chủ
  2. » Công Nghệ Thông Tin

view updating and relational theory

262 371 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 262
Dung lượng 19,11 MB

Nội dung

www.it-ebooks.info www.it-ebooks.info View Updating and Relational Theory Solving the View Update Problem C. J. Date www.it-ebooks.info View Updating and Relational Theory by C. J. Date Copyright © 2013 C. J. Date. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Printing History: January 2013: First Edition. Revision History: 2012-12-12 First release See http://oreilly.com/catalog/errata.csp?isbn=0636920028437 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. View Updating and Relational Theory and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-449-35784-9 [LSI] www.it-ebooks.info Intension extension Edgar F. Codd Invented a notion We now know as views Now view and base relvar Exchangeability Got us all singing Those view update blues —Anon.: Where Bugs Go The duke of Ormond took a view yesterday of his troop, and ordered all that had bay or grey horses to change them for black. —earliest known example (1693) of view updating, quoted in the Oxford English Dictionary from “A Brief Historical Relation of State Affairs 1678–1714,” by Narcissus Luttrell (1857) A little learning is a dangerous thing; Drink deep, or taste not the Pierian spring: There shallow drafts intoxicate the brain, And drinking largely sobers us again. —Alexander Pope: An Essay on Criticism (1711) ─── ♦♦♦♦♦ ─── To my wife Lindy and my daughters Sarah and Jennie with all my love www.it-ebooks.info A b o u t t h e A u t h o r C. J. Date is an independent author, lecturer, researcher, and consultant, specializing in relational database technology. He is best known for his book An Introduction to Database Systems (8th edition, Addison-Wesley, 2004), which has sold well over 850,000 copies at the time of writing and is used by several hundred colleges and universities worldwide. He is also the author of numerous other books on database management, including most recently:  From Addison-Wesley: Databases, Types, and the Relational Model: The Third Manifesto (3rd edition, coauthored with Hugh Darwen, 2006)  From Trafford: Logic and Databases: The Roots of Relational Theory (2007)  From Apress: The Relational Database Dictionary, Extended Edition (2008)  From Trafford: Database Explorations: Essays on The Third Manifesto and Related Topics (coauthored with Hugh Darwen, 2010)  From Ventus: Go Faster! The TransRelational TM Approach to DBMS Implementation (2002, 2011)  From O’Reilly: SQL and Relational Theory: How to Write Accurate SQL Code (2nd edition, 2012)  From O’Reilly: Database Design and Relational Theory: Normal Forms and All That Jazz (2012) Mr. Date was inducted into the Computing Industry Hall of Fame in 2004. He enjoys a reputation that is second to none for his ability to explain complex technical subjects in a clear and understandable fashion. www.it-ebooks.info  C o n t e n t s Preface ix Foreword xv Chapter 1 A Motivating Example 1 The Principle of Interchangeability 3 Base tables only: constraints 5 Base tables only: compensatory actions 6 Views: constraints and compensatory actions 8 There’s no magic 9 Concluding remarks 10 Chapter 2 The Technical Context 11 Relations and relvars 12 Relational assignment 15 Integrity constraints 19 Relvar predicates 21 MATCHING, NOT MATCHING, and EXTEND 25 Databases and dbvars 28 Chapter 3 The View Concept: A Closer Look 31 Views are pseudovariables 33 Data independence 34 How not to do it 38 Constraints and predicates 41 Information equivalence 46 Concluding remarks 49 Chapter 4 Restriction Views 55 The motivating example revisited 55 More on compensatory actions 59 What about triggers? 64 What about explicit UPDATE operations? 66 www.it-ebooks.info vi Contents Suppliers and shipments 68 The motivating example continued 72 Putting it all together 74 The point at last 75 Overlapping restrictions 77 Concluding remarks 79 Chapter 5 Projection Views 81 Example 1: a nonloss decomposition 81 Example 1 continued: the projection relvars 88 Example 1 continued: views 89 Example 2: another nonloss decomposition 90 Example 3: a lossy decomposition 97 Concluding remarks 103 Chapter 6 Join Views I: One to One Joins 105 Example 1: information equivalence 106 Example 2: information hiding 108 Concluding remarks 116 Chapter 7 Join Views II: Many to Many Joins 119 Example 1: information equivalence 119 Projection views revisited 127 Example 2: information hiding 128 Concluding remarks 130 Chapter 8 Join Views III: One to Many Joins 131 Example 1: information equivalence 131 Example 2: information hiding 135 Concluding remarks 137 Chapter 9 Intersection Views 141 Example 1: explicit overlap 142 Example 2: implicit overlap 146 Concluding remarks 153 www.it-ebooks.info Contents vii Chapter 10 Union Views 155 Example 1: disjoint union 155 Example 2: explicit overlap 157 Example 3: implicit overlap 160 Concluding remarks 166 Chapter 11 Difference Views 169 Example 1: implicit overlap 169 Example 2: explicit overlap 176 Concluding remarks 179 Chapter 12 Group and Ungroup Views 181 The GROUP and UNGROUP operators 181 A GROUP / UNGROUP example 185 A SUMMARIZE example 188 Chapter 13 Extension and Summarization Views 193 An EXTEND example 193 Another SUMMARIZE example 197 Chapter 14 Updating through Expressions 201 Semantics not syntax (?) 201 Some well known tautologies 204 “Semantic transformations” 207 Information equivalence revisited 209 Concluding remarks 213 Chapter 15 Ambiguity Revisited 215 Predicates and constraints revisited 216 An intersection example 218 Union and difference examples 220 More on predicates 223 Concluding remarks 224 www.it-ebooks.info viii Contents Appendix A Some Remarks on Relational Assignment 227 Appendix B Relational Operators 233 Index 237 www.it-ebooks.info [...]... this example: David McGoveran: “Accessing and Updating Views and Relations in a Relational Database,” U.S Patent No 7,263,512 (August 28th, 2007) In the case of those previous books of mine in particular, however, I’ll refer to them from this point forward by their abbreviated titles alone (viz., SQL and Relational Theory and Database Design and Relational Theory, respectively) www.it-ebooks.info x... and Relational Theory: How to Write Accurate SQL Code (2nd edition)  Database Design and Relational Theory: Normal Forms and All That Jazz Both of these books were published by O’Reilly in 2012 The first was aimed at database practitioners of all kinds; it explained the principles of relational theory and used those principles as a basis for recommendations on how to use SQL as if it were a true relational. .. simple and familiar terms (actually SQL terms) the approach to view updating to be described in detail in subsequent chapters In particular, it demonstrates that updating is updating, ” regardless of whether it’s a view or base data that’s being updated That’s why, as I said earlier, the book is concerned with what might be called a theory of updating in general—a theory that does apply to views in... Chapter 3 (“The View Concept: A Closer Look”) a more detailed summary of what views in particular are and how they’re supposed to work Who Should Read This Book My target audience is database professionals, or more generally anyone interested in the relational model, relational technology, or relational systems in general As already indicated, familiarity with the SQL and Relational Theory book would... how relational database systems really ought to behave (as opposed to the way today’s commercial SQL systems actually do behave, for the most part) That issue is a theory of updating: a theory that, as the book’s title indicates, applies to the updating of views in particular but is actually more general, in that it applies to the updating of “base data” just as much as it does to the updating of views... the updating of views as such in the book’s title because it seems to me that, while database practitioners in general believe they understand how updating works when the target is base data, they’re typically more than a little skeptical as to whether it really works, or can be made to work, when the target is a view In fact, view updating as such is a surprisingly controversial topic—which was and. .. mentioned, Chapter 2 offers a brief review of pertinent aspects of relational theory In particular, it emphasizes the nature of the database per se as “the one true variable” and hence as the proper target for all operations of an updating nature  Chapter 3 then describes the view concept and related matters in detail Of course, I’ve already said I assume you know what views are in general terms, but this... in Chapters 2 and 3 Acknowledgments I’d like to begin by thanking my wife Lindy once again for her support throughout the production of this book, as well as all of its predecessors I’d also like to thank my friends and colleagues Hugh Darwen, David Livingstone, and David McGoveran for their detailed and comprehensive reviews of earlier drafts of this book Those reviewers and their reviews were all... be controversial when they appeared in the 2007 and 2010 publications I mentioned earlier For example, should a tuple inserted into a view defined on the union of R1 and R2 result in that tuple appearing in both R1 and R2? And should a tuple being deleted from a view defined on the intersection of R1 and R2 result in that tuple disappearing from both R1 and R2? I am on record as being one of those who... evaluated and then (b) the value resulting from that evaluation is assigned to the target variable on the left side, with the overall effect already explained So DELETE is shorthand for a certain relational assignment and, of course, an analogous remark applies to INSERT and UPDATE also: They too are basically just shorthand for certain relational assignments Logically speaking, in fact, relational . www.it-ebooks.info www.it-ebooks.info View Updating and Relational Theory Solving the View Update Problem C. J. Date www.it-ebooks.info View Updating and Relational Theory by C. J. Date . details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. View Updating and Relational Theory and related trade dress. predecessors were as follows:  SQL and Relational Theory: How to Write Accurate SQL Code (2nd edition)  Database Design and Relational Theory: Normal Forms and All That Jazz Both of these

Ngày đăng: 06/05/2014, 09:01

TỪ KHÓA LIÊN QUAN