




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
毕 业 设 计(论 文)外 文 参 考 资 料 及 译 文译文题目: Relational database 关系数据库 学生姓名: 周书湘 学 号: 0705110526 专 业: 计算机科学与技术 所在学院: 信息技术学院 指导教师: 李鸿珍 职 称: 讲师/工程师 2010年 12 月 25 日说明:要求学生结合毕业设计(论文)课题参阅一篇以上的外文资料,并翻译至少一万印刷符(或译出3千汉字)以上的译文。译文原则上要求打印(如手写,一律用400字方格稿纸书写),连同学校提供的统一封面及英文原文装订,于毕业设计(论文)工作开始后2周内完成,作为成绩考核的一部分。Relational database -from / Structure of the Relational databaseThe 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 ColumnsA 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, Data types, and Foreign KeysThe 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 does 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 data types 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 ModelingBefore 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 that can maintain entities, their attributes, and their relationships. In general, an entity corresponds to a table in the database, and the attributes of the entity correspond to columns of the table.Data Modeling: A process of defining the entities, attributes, and relationships between the entities in preparation for creating the physical database.The data-modeling process involves defining the entities, defining the relationships between those entities, and then defining the attributes for each of the entities. Once a cycle is complete, it is repeated as many times as necessary to ensure that the designer is capturing what is important enough to go into the database. Lets take a closer look at each step in the data-modeling process.Defining the EntitiesFirst, the designer identifies all of the entities within the scope of the database application. The entities are the persons, places, or things that are important to the organization and need to be tracked in the database. Entities will most likely translate neatly to database tables. For example, for the first version of Scotts widget company database, he identifies four entities: employees, departments, salary grades, and bonuses. These will become the EMP, DEPT, SALGRADE, and BONUS tables.Defining the Relationships between EntitiesOnce the entities are defined, the designer can proceed with defining how each of the entities is related. Often, the designer will pair each entity with every other entity and ask, Is there a relationship between these two entities? Some relationships are obvious; some are not.In the widget company database, there is most likely a relationship between EMP and DEPT, but depending on the business rules, it is unlikely that the DEPT and SALGRADE entities are related. If the business rules were to restrict certain salary grades to certain departments, there would most likely be a new entity that defines the relationship between salary grades and departments. This entity would be known as an associative or intersection table and would contain the valid combinations of salary grades and departments.Associative Table: A database table that stores the valid combinations of rows from two other tables and usually enforces a business rule. An associative table resolves a many-to-many relationship.In general, there are three types of relationships in a relational database:One-to-many the most common type of relationship is one-to-many. This means that for each occurrence in a given entity, the parent entity, there may be one or more occurrences in a second entity, the child entity, to which it is related. For example, in the widget company database, the DEPT entity is a parent entity, and for each department, there could be one or more employees associated with that department. The relationship between DEPT and EMP is one-to-many.One-to-one In a one-to-one relationship, a row in a table is related to only one or none of the rows in a second table. This relationship type is often used for sub typing. For example, an EMPLOYEE table may hold the information common to all employees, while the FULLTIME, PARTTIME, and CONTRACTOR tables hold information unique to full-time employees, part-time employees, and contractors, respectively. These entities would be considered subtypes of an EMPLOYEE and maintain a one-to-one relationship with the EMPLOYEE table. These relationships are not as common as one-to-many relationships, because if one entity has an occurrence for a corresponding row in another entity, in most cases, the attributes from both entities should be in a single entity.Many-to-many in a many-to-many relationship, one row of a table may be related to many rows of another table, and vice versa. Usually, when this relationship is implemented in the database, a third entity is defined as an intersection table to contain the associations between the two entities in the relationship. For example, in a database used for school class enrollment, the STUDENT table has a many-to-many relationship with the CLASS tableone student may take one or more classes, and a given class may have one or more students. The intersection table STUDENT_CLASS would contain the combinations of STUDENT and CLASS to track which students are in which classes.Assigning Attributes to EntitiesOnce the designer has defined the entity relationships, the next step is to assign the attributes to each entity. This is physically implemented using columns, as shown here for the SALGRADE table as derived from the salary grade entity.After the entities, relationships, and attributes have been defined, the designer may iterate the data modeling many more times. When reviewing relationships, new entities may be discovered. For example, when discussing the widget inventory table and its relationship to a customer order, the need for a shipping restrictions table may arise.Once the design process is complete, the physical database tables may be created. Logical database design sessions should not involve physical implementation issues, but once the design has gone through iteration or two, its job to bring the designers down to earth. As a result, the design may need to be revisited to balance the ideal database implementation versus the realities of budgets and schedules. A database management system is an important type of programming system, used today on the biggest and the smallest computers. As for other major forms of system software, such as compiles and operating systems, a well-understood set of principles for database management systems has developed over the years, and these concepts are useful both for understanding how to use these systems effectively and for designing and implementing database management system. DBMS is a collection of programs that enables you to store, modify, and extract information from a database. There are many different types of management systems, ranging from small systems that run on personal computers to huge systems that run on main frames. 关系数据库摘自/关系数据库的结构关系模型是任何一种关系数据库管理系统的基础。一个关系模型有3个核心部分-对象或关系的集合,作用于对象或关系上的操作,以及数据完整性规则。也就是说,关系数据库包括一个存储数据的地方,一种创建和检索数据的方法,以及一种确认数据的逻辑一致性的方法。关系数据库使用关系或二维表来存储信息。表,行和列在关系数据库中,表也被理解为是一种关系,是二维结构,用来记录信息的关系。数据库由一个或者多个相关联的表组成。注意:不要搞混了关系和关联。关系实际上是一个表,而关联指的是连接、结合或联合两个表的方式。表中的行是一种事物的集合或实例,比如一个员工或发票上的一项。表中的一列包含了某个特定类的所有信息;而且行列交叉点上的数据,字段,就是能够用数据库查询语言检索到的最小单位。例如,一个员工信息表可能有一个“名字”列,包含所有员工的姓。数据是通过对行、列进行过滤检索出来的。主码、数据类型和外码本篇文章均以假设的斯科特史密斯的工厂为例,他是数据库的建立者和企业的主办人。他刚开办了一个饰品公司并目想要使用关系数据库的几项基本功能来管理人力资源部门。关系:用来保存相关信息的一个二维结构(也就是表)。注意:大多数斯科特的雇员都是雇自过去的从业者,他们中有些人在这个领域己经有20年的经验了。出于雇用的目的,斯科特同意在新数据库中保留新进员工最初的雇佣日期。行:在一个数据库表中的一组单数据或多数据元素,用于描述一个人、地方或事物。列:列是数据库表的组件,它包含所有行中同名和同类型的所有数据。你将在接下来的部分学习怎样设计数据库,现在让我们假设数据库大部分己经设计完成并且有一些表需要被执行。斯科特创建了EMP表来保存基本的员工信息,就像这样:注意到佣金列和管理人列中有一些单元格中没有值;它们是空值。一个关系数据库能够强制规定某列是否允许空值。在这种情况下,那些非销售部的员工佣金单元为空。同样老板的雇主单元为空,因为他不需要向任何人汇报工作。单元格:是数据库查询语言所能够检索到的最小片信息。一个单元格就是一个数据库表的行和列交叉形成的。另一方面,没有哪个员工的员工编号单元为空。公司总是为每个员工分配一个员工号,并目每个员工都不同。关系数据库的特征之一是能够保证某列的键入值不会重复。在这个例子中,员工编号就是表的主码。主码:主码是表中的一列(或多列)的值不重复。留意一下员工表中的不同数据类型:数值型,字符型或字母型,以及日期型。你可能会猜测,部门成员列保存的是员工所在部门的编号。不过你怎么才能知道哪个部门名称对应哪个部门编号呢?斯科特建立了部门表来存储员工表中涉及的部门编号的信息。员工表中的部门编号列同部门表中的部门编号列有着相同的值。在这种情况下,员工表中的部门编号列就认为是部门表中相应列外码。外码强化了关系数据库中参考完整性的概念。参考完整性的概念不只可以阻止无效的部门编号被插入员工表中,而且在某部门仍有员工的情况下,可以阻止部门表中删除信息。外码:表中的一列(或多列),它的值来自于其他表的主码列。外码能强化表中数据的完整性。参考完整性:是关系数据库用来加强表间一对多关系的办法之一。数据建模在斯科特于数据库中创建真实表之前,他要做数据建模。在这个过程中,创建者定义和填写数据库中所有表。有一种为数据库建模的常用办法叫作ERA,它可以表示出实体、实体间的关联和实体的属性。设计人员使用一个程序,支持实体、实体属性和实体间关系。通常,一个实体对应数据库中的一张表,属性对应于列。数据建模:定义实体、实体属性和实体间关系,为建立物理数据库做准备。数据建模过程包括定义实体、定义实体间关联以及定义每个实体的属性的过程。一旦一个周期完成,就需要不断重复直到设计者抓住了重
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年中考英语第一轮复习:形容词(含答案解析)
- 2025标准国际贸易合同范本
- 2025内蒙古额尔古纳市第一中学人才引进(第二号)模拟试卷及参考答案详解一套
- 2025网约车服务合同简化版范本
- 2025广西百色市平果市道路运输发展中心城镇公益性岗位人员招聘1人考前自测高频考点模拟试题附答案详解(考试直接用)
- 2025海南海口市秀英区事业单位招聘59人(第一号)模拟试卷及答案详解(夺冠系列)
- 2025保险公司合同
- 2025江苏泰州市兴化市医疗卫生事业单位招聘高层次人才78人(全年)考前自测高频考点模拟试题及答案详解(典优)
- 2025湖北黄冈市武穴市事业单位第二批考核招聘三支一扶服务期满人员1人考前自测高频考点模拟试题及一套答案详解
- 2025年河南金铂来矿业有限公司市场化选聘1人考前自测高频考点模拟试题及答案详解(有一套)
- 02jrc901b电子海图操作jan中文说明书
- 精选幼儿园体能大循环方案
- 全国中学生物理竞赛复赛实验考查
- 例谈小组合作学习在小学英语教学中的有效开展(讲座)课件
- 部编版五年级道德与法治上册第3课《主动拒绝烟酒与毒品》优秀课件【最新】
- 《认识分式》教学课件【初中数学】公开课
- 制造企业物料试用单
- 电力排管检验批
- DB11T 301-2017 燃气室内工程设计施工验收技术规范
- 中考写景散文阅读理解练习及答案
- DB32∕T 3261-2017 水利工程预拌混凝土应用技术规范
评论
0/150
提交评论