关系数据库的结构外文翻译资料

 2022-08-14 03:08

Structure of the Relational database

—《Database System Concepts》Part1: Relational Databases

The relational model is the basis for any relational database management system (RDBMS).A relational model has three core components: a collection of objects or relations, operators that act on the objects or relations, and data integrity methods. In other words, it has a place to store the data, a way to create and retrieve the data, and a way to make sure that the data is logically consistent.

A relational database uses relations, or two-dimensional tables, to store the information needed to support a business. Lets go over the basic components of a traditional relational database system and look at how a relational database is designed. Once you have a solid understanding of what rows, columns, tables, and relationships are, youll be well on your way to leveraging the power of a relational database.

Tables, Row, and Columns

A table in a relational database, alternatively known as a relation, is a two-dimensional structure used to hold related information. A database consists of one or more related tables.

Note: Dont confuse a relation with relationships. A relation is essentially a table, and a relationship is a way to correlate, join, or associate two tables.

A row in a table is a collection or instance of one thing, such as one employee or one line item on an invoice. A column contains all the information of a single type, and the piece of data at the intersection of a row and a column, a field, is the smallest piece of information that can be retrieved with the databases query language. For example, a table with information about employees might have a column called LAST_NAME that contains all of the employees last names. Data is retrieved from a table by filtering on both the row and the column.

Primary Keys, Datatypes, and Foreign Keys

The examples throughout this article will focus on the hypothetical work of Scott Smith, database developer and entrepreneur. He just started a new widget company and wants to implement a few of the basic business functions using the relational database to manage his Human Resources (HR) department.

Relation: A two-dimensional structure used to hold related information, also known as a table.

Note: Most of Scotts employees were hired away from one of his previous employers, some of whom have over 20 years of experience in the field. As a hiring incentive, Scott has agreed to keep the new employees original hire date in the new database.

Row:A group of one or more data elements in a database table that describes a person, place, or thing.

Column:The component of a database table that contains all of the data of the same name and type across all rows.

Youll learn about database design in the following sections, but lets assume for the moment that the majority of the database design is completed and some tables need to be implemented. Scott creates the EMP table to hold the basic employee information, and it looks something like this:

Notice that some fields in the Commission (COMM) and Manager (MGR) columns do not contain a value; they are blank. A relational database can enforce the rule that fields in a column may or may not be empty. In this case, it makes sense for an employee who is not in the Sales department to have a blank Commission field. It also makes sense for the president of the company to have a blank Manager field, since that employee doesnt report to anyone.

Field:The smallest piece of information that can be retrieved by the database query language. A field is found at the intersection of a row and a column in a database table.

On the other hand, none of the fields in the Employee Number (EMPNO) column are blank. The company always wants to assign an employee number to an employee, and that number must be different for each employee. One of the features of a relational database is that it can ensure that a value is entered into this column and that it is unique. The EMPNO column, in this case, is the primary key of the table.

Primary Key:A column (or columns) in a table that makes the row in the table distinguishable from every other row in the same table.

Notice the different datatypes that are stored in the EMP table: numeric values, character or alphabetic values, and date values.

As you might suspect, the DEPTNO column contains the department number for the employee. But how do you know what department name is associated with what number? Scott created the DEPT table to hold the descriptions for the department codes in the EMP table.

The DEPTNO column in the EMP table contains the same values as the DEPTNO column in the DEPT table. In this case, the DEPTNO column in the EMP table is considered a foreign key to the same column in the DEPT table.

A foreign key enforces the concept of referential integrity in a relational database. The concept of referential integrity not only prevents an invalid department number from being inserted into the EMP table, but it also prevents a row in the DEPT table from being deleted if there are employees still assigned to that department.

Foreign Key:A column (or columns) in a table that draws its values from a primary or unique key column in another table. A foreign key assists in ensuring the data integrity of a table. Referential IntegrityA method employed by a relational database system that enforces one-to-many relationships between tables.

Data Modeling

Before Scott created the actual tables in the database, he went through a design process known as data modeling. In this process, the developer conceptualizes and documents all the tables for the database. One of the common methods for modeling a database is called ERA, which stands for entities, relationships, and attributes. The database designer uses an application

剩余内容已隐藏,支付完成后下载完整资料


关系数据库的结构

—《数据库系统的概念》第一部分: 关系数据库

关系模型是任何一个关系数据库管理系统(RDBMS)的基础。一个关系模型有三个核心组成部分: 一个关系或对象的集合, 作用于对象或关系的运算符, 以及数据完整性方法. 换句话来说,它有一个存储数据的地方,一种创建和检索数据的方法,以及一种确保数据在逻辑上一致的方法。

关系数据库使用关系或二维表来存储支持商务所必须的信息。让我们回顾一下传统关系数据库系统的基本部分,看看关系数据库是如何被设计的. 一旦你对行、列、表和关系有了牢固的理解,你将能够很好地利用关系数据库的功能。

表, 行和列

在关系数据库中的表,也被称为关系,是用于保存相关信息的二维结构。数据库由一个或多个相关表组成。

注意:不要混淆关系(relation)和关联(relationships)。关系本质上是一个表,关联是相关、联接或联合两个表的一种方式。

一个表中的一行是一个事物的集合或实例,例如发票上的一个雇员或一个行项目。 一列包含一个类型的所有信息,一行与一列相交处的数据块(字段)是可以使用数据库查询语言检索的最小信息块。 例如,一个包含员工信息的表可能有一个名为LAST_NAME的列,该列包含所有员工的姓氏。 通过对行和列进行过滤,可以从一个表中检索数据。

主键、数据类型和外键

本文中的示例将集中于假定一个名叫斯科特·史密斯的数据库开发人员和企业家的工作。他刚刚成立了一家新的小装置公司,并希望使用关系数据库来管理他的人力资源,从而实现一些基本的业务功能。

关系:用来保存相关信息的二维结构,也称为表。

注:斯科特的大部分雇员都是从他的前一个雇主那里雇来的,其中一些人在这个领域有超过20年的经验。作为招聘激励,斯科特同意将新员工的原始招聘日期保存在新数据库中。

行:数据库表中一个或多个数据元素的一组,用于描述人、地点或事物。

列:数据库表中包含所有行中所有相同名称和类型的数据的部分。

在下面的小节中,您将学习数据库设计,但让我们假设目前大多数数据库设计已经完成,同时需要实现一些表。 斯科特创建EMP表来保存基本的员工信息,它看起来像这样:

注意,佣金(COMM)和经理(MGR)列中的某些字段不包含值:他们是空的。关系数据库可以强制执行列中的字段可以为空,也可以不为空的规则。在这种情况下,对于不在销售部门的员工来说,有一个空白的佣金字段是有意义的。公司总裁有一个空白的经理字段也是有意义的,因为该员工不向任何人报告。

字段:数据库查询语言可以检索的最小信息。 在一个数据库表的一行和一列的交叉处找到字段。

另一方面,员工序号(EMPNO)列中的所有字段都不是空的。 公司总是想给员工分配一个员工编号,每个员工的编号必须不同。关系数据库的一个特点是它可以确保输入到这个列中的值是唯一确定的。在本例中,员工序号(EMPNO)列是表的主键。

主键:表中使表中的行与同一表中的其他行不同的列。

注意EMP表中存储的不同数据类型:数值、字符或字母值,还有日期值。

您可能怀疑,DEPTNO列包含员工的部门号。 但你怎么知道哪个部门的名字和哪个号码有关呢? Scott创建DEPT表来保存EMP表中部门代码的描述。

EMP表中的DEPTNO列包含与DEPT表中的DEPTNO列相同的值。在这种情况下,EMP表中的DEPTNO列被视为DEPT表中同一列的外键。

外键在关系数据库中强制使用参照完整性的概念。参照完整性的概念不仅可以防止将无效的部门号插入EMP表,而且还可以防止在仍有员工分配给该部门时删除DEPT表中的行。

外键:表中从另一个表中的主键列或唯一键列中提取值的列。 外键有助于确保表的数据完整性。参照完整性是关系数据库系统使用的一种方法,它强制表之间的一对多关系。

数据建模

在斯科特在数据库中创建实际的表之前,他经历了一个称为数据建模的设计过程。在这个过程中,开发人员概念化并记录数据库的所有表。数据库建模的一种常用方法称为ERA,代表实体、关系和属性。 数据库设计者使用的应用可以维护实体、它们的属性和它们的关系。 通常,实体对应于数据库中的表,而实体的属性对应于表的列。

数据建模:定义实体、属性和实体之间关系的过程,为创建物理数据库做准备。

数据建模过程包括定义实体、定义这些实体之间的关系,然后定义每个实体的属性。一旦一个周期完成,它将被重复多次,以确保设计者捕获的内容足够重要,可以进入数据库。让我们走近看看数据建模过程中的每个步骤。

定义实体

首先,设计者标识数据库应用范围内的所有实体。实体是对组织重要并需要在数据库中跟踪的人、地点或事物。实体很可能会灵活地转换为数据库表。例如,对于斯科特的小装置公司数据库的第一个版本,他标识了四个实体:员工、部门、工资等级和奖金。这些将成为EMP、DEPT、SALGRADE和BONUS表。

定义实体之间的关系

定义实体后,设计者可以继续定义每个实体之间的关系是怎么样的。通常,设计者会将每个实体与其他实体配对,并询问“这两个实体之间是否存在关系?” 有些关系是显而易见的,有些则不是。

在小装置公司数据库中,EMP和DEPT之间很可能存在关系,但根据业务规则,DEPT和SALGRADE实体之间不太可能存在关联。 如果业务规则将某些薪资等级限制在某些部门,那么很可能会有一个新的实体来定义薪资等级和部门之间的关系。这个实体将被称为关联表或交叉表,它将包含工资等级和部门的有效组合。

关联表:存储来自其他两个表的行的有效组合并通常执行业务规则的数据库表。关联表解析多对多关系。

一般来说,关系数据库中有三种类型的关系:

一对多:最常见的关系类型是一对多。这意味着,对于给定实体(父实体)中的每个事件,第二个实体(子实体)中可能有一个或多个事件与其相关。例如,在widget公司数据库中,DEPT实体是父实体,对于每个部门,可能有一个或多个员工与该部门关联。DEPT与EMP的关系是一对多的。

一对一:在一对一关系中,表中的一行只与第二个表中的一行或一行都不相关。此关系类型通常用于子类型。例如,雇员表可以保存所有员工共同的信息,而FULLTIME, PARTTIME和CONTRACTOR表分别保存全职员工、兼职雇员和承包商的信息。这些实体将被视为EMPLOYEE的子类型,并与EMPLOYEE表保持一对一的关系。这些关系不像一对多关系那样常见,因为如果一个实体在另一个实体中有对应行的出现,在大多数情况下,两个实体的属性都应该在一个实体中。

多对多:在多对多关系中,一个表的一行可能与另一个表的多行相关,反之亦然。 通常,在数据库中实现此关系时,第三个实体被定义为交叉表,以包含关系中两个实体之间的关联。例如,在用于学校班级注册的数据库中,STUDENT表与CLASS表具有多对多的关系一个学生可以参加一个或多个班级,而一个给定班级可以有一个或多个学生。交叉表STUDENT_CLASS将包含STUDENT和CLASS的组合,以跟踪哪些学生在哪个班级中。

一旦设计者定义了实体关系,下一步就是为每个实体分配属性。这在物理上是使用列实现的,如这里来源于薪水等级实体SALGRADE表所示。

在定义了实体、关系和属性之后,设计者可以多次迭代数据建模。 在回顾关系时,可能会发现新的实体。例如,当讨论小装置盘存表及其与客户订单的关系时,需要装运限制表可能出现。  

一旦设计过程完成,就可以创建物理数据库表。逻辑数据库设计会议不应该涉及物理实现问题,但一旦设计经过一两次迭代,DBA的工作就是让设计人员“脚踏实地”。因此,可能需要重新审视设计,以平衡理想的数据库实现与预算和时间表的实际情况。

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[235407],资料为PDF文档或Word文档,PDF文档可免费转换为Word

原文和译文剩余内容已隐藏,您需要先支付 30元 才能查看原文和译文全部内容!立即支付

以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。