《Database.System.Concepts》【7.7 Entity-Relationship Design Issues】(P290~295)翻

原著链接:[Database.System.Concepts(6th.Edition.2010)].Abraham.Silberschatz.文字版[www.xuexi111.com].pdf

原著作者:Silberschatz, Abraham/ Korth, Henry F./ Sudarshan, S. 

实体—关系设计问题

   实体关系设计解决了实体集和关系集的概念不精确的问题,并且可以以多种不同的方式定义一组实体及其关系。在这一部分中,我们研究的基本问题,在数据库的 E-R 模型的设计。第 7.10 部分详细介绍了设计过程。
7.71 实体集与属性的使用

   考虑使用附加属性phone_number的实体集指导员(图-ure7.17a)。可以很容易地认为,电话本身就是一个实体,具有属性phone_n u mber和位置;该位置可能是电话所在的办公室或家,移动(手机)电话可能以“Mobile”值表示。如果我们从这个角度出发,我们不会将属性phone_number添加到讲师。相反,我们创建:

  •  具有属性、电话号码和位置的电话实体。
  •  一种关系设定为inst_phone,表示教师和他们拥有的电话之间的关联。

   图7.17B。因此,这两个定义的主要区别在于,指导者将电话视为属性phone_室长,这意味着教师每个人都有一个电话号码。将电话当作实体电话允许指导员有几个电话号码(包括零)与他们相关联。但是,我们可以轻松地将phone_number定义为多值属性,以便允许每个指导员使用多个电话。

   主要区别在于,把手机作为一个实体更好地建模的情况下,一个可能要保留关于手机的额外信息,如它的位置,或它的类型(手机,LP电话,或普通老式电话),或所有谁分享电话。因此,将电话视为一个实体比将其视为一个属性更为普遍,并且在一般性可能有用时也是合适的。

 

   相反,将属性名称(指导员)作为一个实体来处理是不合适的;很难争辩说名称本身就是一个实体(与电话相反)。因此,将name作为指导员实体集的属性是合适的。

   因此产生了两个自然问题:什么构成属性?什么构成实体集?不幸的是,没有简单的答案。这些差异主要取决于被建模的现实世界企业的结构,以及与所涉及的属性相关的语义。

   一个常见的错误是将实体集的主键用作另一个实体集的属性,而不是使用关系。例如,如果每个教员只建议一个学生,将学生的ID作为教师的属性进行建模是错误的。关系顾问是代表学生和教师之间的联系的正确方式,因为它使他们的关系明确的,而不是通过一个属性的隐式。

人们有时犯的另一个相关错误是将相关实体集的主键属性指定为关系集的属性。例如,ID(学生的关键属性)和身份(教官的主键)不应该出现的adoisor属性关系。这个不应该这样做,因为主键属性已经在关系集中隐含了。

7.72 实体集与关系集的使用

   并不总是清楚对象是最好的用实体集还是关系集来表示。在图7.15中,我们使用了Tnodel设置的采取关系,即学生上(某一节)课程的情况。另一种办法是设想每一位学生都有一份课程注册记录。然后,我们设置了一个实体来表示课程注册记录。让我们称之为实体集注册。每个注册实体都与一个学生和一个部分完全相关,因此我们有两个关系集,一个是将课程注册记录与学生联系起来,另一个是将课程注册记录与部门相关联。在图7.18中,我们显示了图7.15中的实体集部分和学生,图7.15中的取舍关系集被一个实体集和两个关系集所取代:

  • 注册,表示课程注册记录的实体集。
  • 第三节,与注册和课程相关的关系集。
  •  学生注册与学生关系集。

   请注意,我们使用双线表示注册实体的总体参与情况。图7.15和图7.18的方法都准确地表示了大学的信息,但是使用VISS更简洁,而且可能更好。然而,如果注册机构将其他信息与课程注册记录联系在一起,最好将其作为一个独立的实体。

 


   确定是使用实体集还是关系集的一个可能准则是指定关系集来描述在各实体之间发生的操作。这种方法在决定某些属性是否可以更恰当地表示为关系时也很有用。

7.73 二进制与n元关系集

   数据库中的关系通常是二进制的。一些看似非二进制的关系实际上可以更好地由几个二进制关系来表示。例如,我们可以建立一个三元关系的父母,把孩子和他的父母联系起来。然而,这种关系也可以由两种二元关系来代表,即另一种关系和父亲关系,分别将子女与其母亲和父亲联系起来。使用这两种关系,母亲和父亲为我们提供了孩子母亲的记录,即使我们不知道父亲的身份;如果使用三元关系父母,则需要一个空值。在这种情况下,最好使用二进制关系集。

   实际上,总是可以用许多不同的二进制关系集来替换非二进制(n-ary,对于n>2)关系集。为简单起见,考虑抽象三元(n=3)关系集R、关联实体集A、B和C。我们用实体集E替换关系集E,并创建三个关系集,如图7.19所示。

  • Ra,关联E和A
  • RB,关联E和B
  • RC,关联E和C

 

   如果关系集 R 具有任何属性, 则将这些属性赋给实体集 E;此外, 为 E 创建了一个特殊的标识属性 (为能够根据属性值对实体集中的不同实体进行区分)。对于关系集 R 中的每个关系 (ai + bi、Ci), 我们创建一个新的实体ei. 然后, 在三新的关系集中, 我们插入一个如下关系:

  • (ei,ai)in RA
  • (ei,bi) in RB
  • (ei,ci) in RC

   我们可以直截了当地将这个过程概括为n元关系。因此, 从概念上讲, 我们可以限制 e-R 模型只包含二进制关系集。然而, 这种限制并不总是可取的。

  • 可以为创建的实体集创建标识属性, 以便表示关系集。此属性以及额外的关系设置需要, 增加设计的复杂性和 (我们可以在第7.6 节看到) 总体存储要求。
  • 多元关系集更清楚地显示了几个实体之间单一的关系。
  • 可能没有一种方法来转换对三元关系的约束到二进制关系的约束。例如, 考虑一个约束,  R 是多对一从 A, B 到 C;即每对A 和 B 中的实体最多与一个 C 实体关联。此约束不能通过在关系集上使用基数约束来表示RA,RB 和 RC

   请考虑 "关系集" 项目指南在7.2.2, 相关讲师,学生和项目。我们不能直接将项指南分成二进制关系教师与项目之间以及教师与学生之间的关系。如果我们这样做,我们将能够记录教师 Katz 和学生Shankar和张一起做的工作A和B;然而, 我们将无法记录的 Katz在项目 a 与学生Shankar一起工作以及项目 B 与学生一起工作, 但无法和张一起完成工作A与Shankar一起完成工作B

 


关系集项目指南可以通过创建如上文所述的新实体集。然而, 这样做不会很自然。

7.7.4关系属性的设置

   关系的基数比可能影响关系的放置属性.因此, 一对一或一对一关系集的属性可以与参与实体集之一关联, 而不是与关系集相关联。例如,让我们指定顾问是一个一对多的关系这样一个教练会建议几个学生,但每一个学生都只有一个教练的建议。在这种情况下,属性中指定的日期,当教师成为学生的顾问,可能与学生实体集,如图7.20示。(未来使看起来简单,只显示两个实体集的属性。)由于每个学生的实体参与最多的一个实例的教练的关系,使得这属性名称相同的意思会和顾问将日期建立关系,一对多关系集的位置可以改变属性只有实体集的关系的“多”的一面。在一对一关系集,另一方面,关系属性可以实体的任何一个。

   设计决策的地方描述属性,在这种情况下作为一个关系或实体属性应体现的特点企业建模,设计者可以选择保留日期作为一个属性顾问表达明确的日期是指关系的建议而不是其他方面的学生的大学的地位(例如,大学的录取时间)。

   对于多对多关系集, 属性位置的选择更为明确。回到我们的例子, 让我们指定也许更现实的情况下, 顾问是一个多对多关系集表示讲师可能建议一个或多个学生, 和一个学生可能被告知一个或更多的导师。如果我们要表达一个特定讲师的日期成为特定学生的顾问, 日期必须是顾问的属性关系集, 而不是任何一个参与实体。如果日期是学生的属性, 例如, 我们不能确定哪个讲师成为那个特定日期的顾问。当属性由参与实体集的组合 (而不是单独的实体) 确定时, 该属性必须与多对多关系集关联。图7。3将日期的位置描述为关系属性;再次, 保持数字简单, 只显示两个实体集的某些属性。

   虽然E-R基本概念模型大多数数据库的特点,某些方面一个数据库可能更贴切的表达一定的扩展的基础E-R模型。在这一部分中,我们讨论了专业化扩展E-R特征化、一般化,较高和较低级别的实体集,属性继承和聚集。

   为了帮助讨论, 我们将使用一个稍微复杂的数据库大学的模式。特别是, 我们将模型的各种人通过定义实体集人, 具有属性 ID、名称和地址。

7.8.1 特别化

   实体集可能包括以某种方式不同的实体的 再组来自集合中的其他实体。例如, 实体集内的实体子集
可能具有实体集中的所有实体都不共享的属性。电子R模型提供了表示这些特殊实体分组的方法。

作为一个例子,该实体组可以被进一步分类为如下所示

员工

学生

 

 

这些类型中的每一个都由一组属性描述, 其中包括所有实体集人员的属性加上可能附加的属性。例如, 雇员实体可以由属性工资进一步描述, 而学生实体可以由属性绩点进一步描述。的过程中在实体集中指定再分组称为专门化。人的专业化使我们能够根据他们是否对应于雇员或学生: 一般来说, 一个人可能是一个雇员, 一个学生, 或者两者都不是。

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Database System Concepts——数据库系统概念第六版(英文版) 作者: Abraham Silberschatz (Yale University) Henry F. Korth (Lehigh University) S. Sudarshan (Indian Institute of Technology, Bombay) 本书目录: Chapter 1 Introduction 1.1 Database-System Applications 1 1.2 Purpose of Database Systems 3 1.3 View of Data 6 1.4 Database Languages 9 1.5 Relational Databases 12 1.6 Database Design 15 1.7 Data Storage and Querying 20 1.8 Transaction Management 22 1.9 Database Architecture 23 1.10 Data Mining and Information Retrieval 25 1.11 Specialty Databases 26 1.12 Database Users and Administrators 27 1.13 History of Database Systems 29 1.14 Summary 31 Exercises 33 Bibliographical Notes 35 Chapter 2 Introduction to the RelationalModel 2.1 Structure of Relational Databases 39 2.2 Database Schema 42 2.3 Keys 45 2.4 Schema Diagrams 46 2.5 Relational Query Languages 47 2.6 Relational Operations 48 2.7 Summary 52 Exercises 53 Bibliographical Notes 55 Chapter 3 Introduction to SQL 3.1 Overview of the SQL Query Language 57 3.2 SQL Data Definition 58 3.3 Basic Structure of SQL Queries 63 3.4 Additional Basic Operations 74 3.5 Set Operations 79 3.6 Null Values 83 3.7 Aggregate Functions 84 3.8 Nested Subqueries 90 3.9 Modification of the Database 98 3.10 Summary 104 Exercises 105 Bibliographical Notes 112 Chapter 4 Intermediate SQL 4.1 Join Expressions 113 4.2 Views 120 4.3 Transactions 127 4.4 Integrity Constraints 128 4.5 SQL Data Types and Schemas 136 4.6 Authorization 143 4.7 Summary 150 Exercises 152 Bibliographical Notes 156 Chapter 5 Advanced SQL 5.1 Accessing SQL From a Programming Language 157 5.2 Functions and Procedures 173 5.3 Triggers 180 5.4 Recursive Queries 187 5.5 Advanced Aggregation Features 192 5.6 OLAP 197 5.7 Summary 209 Exercises 211 Bibliographical Notes 216 Chapter 6 Formal Relational Query Languages 6.1 The Relational Algebra 217 6.2 The Tuple Relational Calculus 239 6.3 The Domain Relational Calculus 245 6.4 Summary 248 Exercises 249 Bibliographical Notes 254 Chapter 7 Database Design and the E-R Model 7.1 Overview of the Design Process 259 7.2 The Entity-Relationship Model 262 7.3 Constraints 269 7.4 Removing Redundant Attributes in Entity Sets 272 7.5 Entity-Relationship Diagrams 274 7.6 Reduction to Relational Schemas 283 7.7 Entity-Relationship Design Issues 290 7.8 Extended E-R Features 295 7.9 Alternative Notations for Modeling Data 304 7.10 Other Aspects of Database Design 310 7.11 Summary 313 Exercises 315 Bibliographical Notes 321 Chapter 8 Relational Database Design 8.1 Features of Good Relational Designs 323 8.2 Atomic Domains and First Normal Form 327 8.3 Decomposition Using Functional Dependencies 329 8.4 Functional-Dependency Theory 338 8.5 Algorithms for Decomposition 348 8.6 Decomposition Using Multivalued Dependencies 355 8.7 More Normal Forms 360 8.8 Database-Design Process 361 8.9 Modeling Temporal Data 364 8.10 Summary 367 Exercises 368 Bibliographical Notes 374 Chapter 9 Application Design and Development 9.1 Application Programs and User Interfaces 375 9.2 Web Fundamentals 377 9.3 Servlets and JSP 383 9.4 Application Architectures 391 9.5 Rapid Application Development 396 9.6 Application Performance 400 9.7 Application Security 402 9.8 Encryption and Its Applications 411 9.9 Summary 417 Exercises 419 Bibliographical Notes 426 Chapter 10 Storage and File Structure 10.1 Overview of Physical Storage Media 429 10.2 Magnetic Disk and Flash Storage 432 10.3 RAID 441 10.4 Tertiary Storage 449 10.5 File Organization 451 10.6 Organization of Records in Files 457 10.7 Data-Dictionary Storage 462 10.8 Database Buffer 464 10.9 Summary 468 Exercises 470 Bibliographical Notes 473 Chapter 11 Indexing and Hashing 11.1 Basic Concepts 475 11.2 Ordered Indices 476 11.3 B+-Tree Index Files 485 11.4 B+-Tree Extensions 500 11.5 Multiple-Key Access 506 11.6 Static Hashing 509 11.7 Dynamic Hashing 515 11.8 Comparison of Ordered Indexing and Hashing 523 11.9 Bitmap Indices 524 11.10 Index Definition in SQL 528 11.11 Summary 529 Exercises 532 Bibliographical Notes 536 Chapter 12 Query Processing 12.1 Overview 537 12.2 Measures of Query Cost 540 12.3 Selection Operation 541 12.4 Sorting 546 12.5 Join Operation 549 12.6 Other Operations 563 12.7 Evaluation of Expressions 567 12.8 Summary 572 Exercises 574 Bibliographical Notes 577 Chapter 13 Query Optimization 13.1 Overview 579 13.2 Transformation of Relational Expressions 582 13.3 Estimating Statistics of Expression Results 590 13.4 Choice of Evaluation Plans 598 13.5 Materialized Views 607 13.6 Advanced Topics in Query Optimization 612 13.7 Summary 615 Exercises 617 Bibliographical Notes 622 Chapter 14 Transactions 14.1 Transaction Concept 627 14.2 A Simple Transaction Model 629 14.3 Storage Structure 632 14.4 Transaction Atomicity and Durability 633 14.5 Transaction Isolation 635 14.6 Serializability 641 14.7 Transaction Isolation and Atomicity 646 14.8 Transaction Isolation Levels 648 14.9 Implementation of Isolation Levels 650 14.10 Transactions as SQL Statements 653 14.11 Summary 655 Exercises 657 Bibliographical Notes 660 Chapter 15 Concurrency Control 15.1 Lock-Based Protocols 661 15.2 Deadlock Handling 674 15.3 Multiple Granularity 679 15.4 Timestamp-Based Protocols 682 15.5 Validation-Based Protocols 686 15.6 Multiversion Schemes 689 15.7 Snapshot Isolation 692 15.8 Insert Operations, Delete Operations, and Predicate Reads 697 15.9 Weak Levels of Consistency in Practice 701 15.10 Concurrency in Index Structures 704 15.11 Summary 708 Exercises 712 Bibliographical Notes 718 Chapter 16 Recovery System 16.1 Failure Classification 721 16.2 Storage 722 16.3 Recovery and Atomicity 726 16.4 Recovery Algorithm 735 16.5 Buffer Management 738 16.6 Failure with Loss of Nonvolatile Storage 743 16.7 Early Lock Release and Logical Undo Operations 744 16.8 ARIES 750 16.9 Remote Backup Systems 756 16.10 Summary 759 Exercises 762 Bibliographical Notes 766 Chapter 17 Database-System Architectures 17.1 Centralized and Client–Server Architectures 769 17.2 Server System Architectures 772 17.3 Parallel Systems 777 17.4 Distributed Systems 784 17.5 Network Types 788 17.6 Summary 791 Exercises 793 Bibliographical Notes 794 Chapter 18 Parallel Databases 18.1 Introduction 797 18.2 I/O Parallelism 798 18.3 Interquery Parallelism 802 18.4 Intraquery Parallelism 803 18.5 Intraoperation Parallelism 804 18.6 Interoperation Parallelism 813 18.7 Query Optimization 814 18.8 Design of Parallel Systems 815 18.9 Parallelism on Multicore Processors 817 18.10 Summary 819 Exercises 821 Bibliographical Notes 824 Chapter 19 Distributed Databases 19.1 Homogeneous and Heterogeneous Databases 825 19.2 Distributed Data Storage 826 19.3 Distributed Transactions 830 19.4 Commit Protocols 832 19.5 Concurrency Control in Distributed Databases 839 19.6 Availability 847 19.7 Distributed Query Processing 854 19.8 Heterogeneous Distributed Databases 857 19.9 Cloud-Based Databases 861 19.10 Directory Systems 870 19.11 Summary 875 Exercises 879 Bibliographical Notes 883 Chapter 20 DataWarehousing andMining 20.1 Decision-Support Systems 887 20.2 DataWarehousing 889 20.3 Data Mining 893 20.4 Classification 894 20.5 Association Rules 904 20.6 Other Types of Associations 906 20.7 Clustering 907 20.8 Other Forms of Data Mining 908 20.9 Summary 909 Exercises 911 Bibliographical Notes 914 Chapter 21 Information Retrieval 21.1 Overview 915 21.2 Relevance Ranking Using Terms 917 21.3 Relevance Using Hyperlinks 920 21.4 Synonyms, Homonyms, and Ontologies 925 21.5 Indexing of Documents 927 21.6 Measuring Retrieval Effectiveness 929 21.7 Crawling and Indexing the Web 930 21.8 Information Retrieval: Beyond Ranking of Pages 931 21.9 Directories and Categories 935 21.10 Summary 937 Exercises 939 Bibliographical Notes 941 Chapter 22 Object-Based Databases 22.1 Overview 945 22.2 Complex Data Types 946 22.3 Structured Types and Inheritance in SQL 949 22.4 Table Inheritance 954 22.5 Array and Multiset Types in SQL 956 22.6 Object-Identity and Reference Types in SQL 961 22.7 Implementing O-R Features 963 22.8 Persistent Programming Languages 964 22.9 Object-Relational Mapping 973 22.10 Object-Oriented versus Object-Relational 973 22.11 Summary 975 Exercises 976 Bibliographical Notes 980 Chapter 23 XML 23.1 Motivation 981 23.2 Structure of XML Data 986 23.3 XML Document Schema 990 23.4 Querying and Transformation 998 23.5 Application Program Interfaces to XML 1008 23.6 Storage of XML Data 1009 23.7 XML Applications 1016 23.8 Summary 1019 Exercises 1021 Bibliographical Notes 1024 PART EIGHT ADVANCED TOPICS Chapter 24 Advanced Application Development 24.1 Performance Tuning 1029 24.2 Performance Benchmarks 1045 24.3 Other Issues in Application Development 1048 24.4 Standardization 1051 24.5 Summary 1056 Exercises 1057 Bibliographical Notes 1059 Chapter 25 Spatial and Temporal Data andMobility 25.1 Motivation 1061 25.2 Time in Databases 1062 25.3 Spatial and Geographic Data 1064 25.4 Multimedia Databases 1076 25.5 Mobility and Personal Databases 1079 25.6 Summary 1085 Exercises 1087 Bibliographical Notes 1089 Chapter 26 Advanced Transaction Processing 26.1 Transaction-Processing Monitors 1091 26.2 TransactionalWorkflows 1096 26.3 E-Commerce 1102 26.4 Main-Memory Databases 1105 26.5 Real-Time Transaction Systems 1108 26.6 Long-Duration Transactions 1109 26.7 Summary 1115 Exercises 1117 Bibliographical Notes 1119 Chapter 27 PostgreSQL 27.1 Introduction 1123 27.2 User Interfaces 1124 27.3 SQL Variations and Extensions 1126 27.4 Transaction Management in PostgreSQL 1137 27.5 Storage and Indexing 1146 27.6 Query Processing and Optimization 1151 27.7 System Architecture 1154 Bibliographical Notes 1155 Chapter 28 Oracle 28.1 Database Design and Querying Tools 1157 28.2 SQL Variations and Extensions 1158 28.3 Storage and Indexing 1162 28.4 Query Processing and Optimization 1172 28.5 Concurrency Control and Recovery 1180 28.6 System Architecture 1183 28.7 Replication, Distribution, and External Data 1188 28.8 Database Administration Tools 1189 28.9 Data Mining 1191 Bibliographical Notes 1191 Chapter 29 IBM DB2 Universal Database 29.1 Overview 1193 29.2 Database-Design Tools 1194 29.3 SQL Variations and Extensions 1195 29.4 Storage and Indexing 1200 29.5 Multidimensional Clustering 1203 29.6 Query Processing and Optimization 1207 29.7 Materialized Query Tables 1212 29.8 Autonomic Features in DB2 1214 29.9 Tools and Utilities 1215 29.10 Concurrency Control and Recovery 1217 29.11 System Architecture 1219 29.12 Replication, Distribution, and External Data 1220 29.13 Business Intelligence Features 1221 Bibliographical Notes 1222 Chapter 30 Microsoft SQL Server 30.1 Management, Design, and Querying Tools 1223 30.2 SQL Variations and Extensions 1228 30.3 Storage and Indexing 1233 30.4 Query Processing and Optimization 1236 30.5 Concurrency and Recovery 1241 30.6 System Architecture 1246 30.7 Data Access 1248 30.8 Distributed Heterogeneous Query Processing 1250 30.9 Replication 1251 30.10 Server Programming in .NET 1253 30.11 XML Support 1258 30.12 SQL Server Service Broker 1261 30.13 Business Intelligence 1263 Bibliographical Notes 1267

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值