database system concepts

    关系数据库由一组表组成,每个表是一个被标记的独一无二的。例如,观察图2.1的教师表,它储存了大量的关于教师们的信息。那张表有4张数据域标题,学号,名字,课程名称,和工资。这张表的每行都记录了关于老师的信息。包括了身份证,名字,课程名称,和工资。类似的,那图2.2的表格储存了关于由资源名称,题目,课程名称,学分,对于每个名称。注意每位老师都是通过列id的值来标识的,而每一门课程都是由列课程id的值来标识的。

    2.3展示了一个表,prerep,这储存了必先具备的课程。这张表有两列,课程名称,和prerep名称。每行由一双课程身份标识,例如,那第二课程是一个第一门课的先决条件。

然而,在那张表里的每行都表明了两个课程是在某种意义上相关的,就是一个课程是另一个课程的先决条件.

指定ID与名称、部门名称和工资对应价值之间的关系。
一般来说,表中的一行表示一组数值之间的关系。从关系数据模型的名字来看,由于表是这种关系的集合,表的概念与关系的数学概念有着密切的对应关系。在数学术语中,元组只是值的序列(或列表),是一个关系——关于n值之间的数学表示的值的元组,即具有n个值的元组,它对应于表中的一行。

因此,在关系模型中,术语Relationship用于引用表,而tuple则用于引用行。类似地,术语属性指表的一列。查看图2.1,我们可以看到关系指导员有四个属性:ID、Name、Det Name和工资。我们使用关系实例来引用关系的特定实例,即包含特定的行集。图2.1所示的讲师实例有12个元组,对应于12个教员。在本章中,我们将使用许多不同的关系来说明关系数据模型的各种概念。这些关系代表了大学的一部分。为了简化我们的演示,他们没有包括大学数据库中包含的所有数据。我们将在第7章和第8章中详细讨论关系结构是否合适的标准。元组在关系中出现的顺序是无关的,因为关系是一个集合。

那两张图是相同的,因为两者都包含了相同的元组。为了便于解释,我们将大力的展示被分类的他们的第一属性。

   对于每个关系的属性,都有一种被允许的价值叫做该属性的域。然而那教师关系的薪水的领域属性是一套所有可能的薪水价值,而且那名字属性的领域是一种所有可能的指令名的集合。

   我们要求,对于所有的关系,所有的属性的领域应该是自动的。一个领域是自动的,如果领域的要素被认为是不可分割的单位。例如,想象一下那教师表有一个电话号码的属性,它可以分一串的对应的电话号码给教师。然而那电话号码的领域将不会自动化,因为领域其中的一个要素是一串电话号码,它有元件,也就是说在集合中,它是必不可分的。

   那重要的问题不是领域本身自己,而是我们在我们的数据库中如何使用领域这个要素。 现在假设电话号码属性储存一个单一的电话号码。即使如此,如果我们把电话号码属性中的值拆分为国家代码,地区代码,和当地代码,我们将会把它当作一个非原子值。如果我们对待每个电话号码像作为一个不可分割的单元,那么那电话号码属性将有一个原子领域。

   在这篇文章中,也就是片段3第6部分,我们假定所有属性有原子领域。在片段22中,我们该讨论允许非原子域的关系数据模型。

   空值是一个特殊的值,表示该值未知或不存在。例如,在猜想之前,我们在教师关系里包括了电话号码属性。它可能是一个电话号码什么都没有的教师,或者那电话号码是没有列于表格的。我们将不得不使用空值来表示那值是未知的或者不存在的。当我们进入或更新数据库的时候,我们应当好好看看之后会空值引起许多困难,因此,如果可能的话,应该予以消除。我们应好好想想空值是最初缺席的,在3.6单元我们描述了没有不同操作空值的影响。

  .当我们讨论数据库时,我们必须区分数据库模式,即数据库的逻辑设计,以及数据库实例,它是数据库中的数据,在给定的时间内的快照。关系的,概念,对于一个变量的编程语言,而关系模式的概念对应于,类型定义的编程语言概念。一般来说,关系模式是一个属性列表和他们的相关区域。在我们讨论这个,之前,我们不会关心每个属性,的区域的定义。语言在第三章。关系实例的概念,对应变量值的编程语言概念。给定变量的,类型可能随时间而改变。

   .类似的,关系实例的内容,随着关系的更新而随时间而变化。相反,关系的模式通常不会改变关系。虽然知道关系模式和关系,实例,之间的区别很重要,但是我们经常使用相同的名称,例如讲师,来引导模式和实例。在需要时,我们显示的引用模式或实例。例如,教员模式或教员关系的实例。但是当我们明确表示模式或,实例时,我们只使用关系名称。考虑图2.5的组成关系,这种关系的模式是部门(所有员工,建筑,预算)。  注意属性,员工出现在教师模式和时间表和部门计划。这种,重复并非巧合。襄樊在关系模式中使用公共属性是关联不同关系元组的一种方法。例如,假设我们希望找到关于在沃申大楼工作的所有员工的信息。我们首先看一下部门关系,找到了在watson部门工作的员工jame。然后对于每一个这样的部门,我们在教师关系中查询与相应的部门相关的讲师信息。让我们继续我们的大学数据库示例,大学里的每门课程都可以提供多次,跨越不同的学期,甚至是一个学期,我大学里的每门课程都可以提供多次,跨越不同的学期,甚至是一个学期,我,我语,我大学里的每门课程都可以提供多次,跨越不同的学期,甚至是一个学期。我们需要一个关系来描述每一个独立的提供货节的课程,模式部分(课程编号,secid,学期,学年,建筑,教室编号,上课时间。图2.6,显示了几段关系的一个事例,我们需要一个关系来描述教师和学生之间的关系,以及他们教的课程。描述该关联的模式是,教师(ID,课程,选择,学期,年份)。

从图2.7中展示了一个教师关系的示例实例。正如你所想像的,有非常多保持在一个真实的大学数据库。除此之外,那些我们已经列入的关系,教师,公寓,课程,单元,prepeq,和老师们。我们在这文章中使用了以下的关系。

我们必须有一种方法来指定给定关系中的元组是如何被释放的。这是用它们的属性来表示的。也就是说,元组属性值的值必须是能够唯一标识元组的值。换句话说,关系中的两个元组对所有属性都不允许具有完全相同的值。超级键是一个或多个属性集合的集合,它允许我们在关系中唯一地标识一个元组。例如,关系指导员的ID属性足以区分一个指导员元组和另一个指导员元组,因此ID是一个超级键。另一方面,指导员的name属性不是超级键,因为几个指导员的名字可能是相同的,形式上,让R表示关系模式r中的属性集。如果我们说R的一个子集K是r的一个超级键,那么我们将考虑的范围限制在关系r的实例上,其中没有两个不同的元组对K中的所有属性都有相同的值。

主关键字应该被选择,如果这样,它的属性值就永远不会或很少会改变。
    例如,一个person的地址字段不应该是主关键字的一部分,因为它很可能会改变。从另一方面来说,社保号码保证不会改变。
企业产生的唯一标识符一般不改变,除非两个企业合并;在这种情况下,两个企业可能都发出相同的标识符,并且可能需要重新分配标识符以确保它们是唯一的。
   我们都习惯在其他属性之前列出关系模式的主键属性;例如,我们会首先将部门的部门名称属性列出来,因为它是主关键字。主键属性也需要强调。举例来说,一个关系,比如R1,可以在它的属性中包含另一个关系的主键,比如R2。此属性称为来自R1的外键,引用R2。因此关系R1也称为外键从属关系的引用关系,而R2称为外键的引用关系。例如,讲师中的属性部门名称被认为是来自导师、引用部门的外键,因为部门名称是部门的主键。在部门关系中必须有一个元组,比如TB,所以TA的部门名称属性的值,主键和部门名称与TB的值相同。现在考虑这个部分与教学的关系。如果一个课程存在一个部分,那么必须至少由一个教师来授课;当然,它可能由不止一个教师教授。为了保证一个特定的老师来教授,我们需要在一节中出现一个特定的组合(如课程ID,秒ID,学期,年份等),那么这些同样的组合必须出现在教学中。
    然而,这套值并不能构成教师的主键,因为不止一个教师可以教这样一个部分。因此,我们不能从节中声明外键约束(尽管我们可以在另一个方向定义外键约束,从教育到剖析)。

从剖析到教育的约束是引用完整性约束的一个例子;引用完整性约束要求在引用关系中任何元组的指定属性中出现的值,也需要出现在引用关系中的至少一个元组的指定属性中。图表可以通过架构图描述数据库模式,以及主键和外键依赖关系。图2.8显示了我们大学组织的架构图。每个关系都显示为一个框,顶部的关系名称是蓝色,而属性则在框中列出。主键属性显示为下划线。外键依赖项从引用关系的外键属性到引用关系的主键出现。

                翻译自《DATABASE SYSTEM CONCEPTS》  Abraham Silberschatz   Henry F.Korth   S.Sudarshan

  • 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、付费专栏及课程。

余额充值