data 3

¡Supera tus tareas y exámenes ahora con Quizwiz!

Relationships within the Relational Database

1:M relationship : Relational modeling ideal, Should be the norm in any relational database design。 1:1 relationship : Should be rare in any relational database design。 M:N relationships : Cannot be implemented as such in the relational model。 M:N relationships can be changed into 1:M relationships

Integrity Rules

1Entity Integrity: ensures that each row is uniquely identified by the primary key. Ensures a proper search for an existing tuple (row) will always be successful. 2Referential integrity: if the foreign key contains a value, that value refers to an existing valid tuple (row) in another relation. ensures that it will be impossible to assign a non-existing foreign key value to a table.

Keys - Characteristics

1Entity integrity :Each row (entity instance) in the table has its own unique identity, 2Nulls:No data entry,Not permitted in primary key,Should be avoided in other attributes。 3Nulls Can represent:An unknown attribute value,A known, but missing, attribute value,A "not applicable" condition,Can create problems when functions such as COUNT, AVERAGE, and SUM are used,Can create logical problems when relational tables are linked,

Relational Set Operators (cont'd.)

1Left outer join :Yields all of the rows in the CUSTOMER table,Including those that do not have a matching value in the AGENT table。 2Right outer join :Yields all of the rows in the AGENT table,Including those that do not have matching values in the CUSTOMER table。

Relational Set Operators (cont'd.)

1Natural join:Links tables by selecting rows with common values in common attributes。 (join columns) 2Equijoin:Links tables on the basis of an equality condition that compares specified columns。 3Theta join:Any other comparison operator is used。 4Inner join:Only returns matched records from the tables that are being joined。 5Outer join:Matched pairs are retained, and any unmatched values in other table are left null。

Types of Keys

1Primary key (PK) :unique identify An attribute that is a unique identifier for each record , 2Foreign key (FK) polling another table to link them together , 3An attribute whose values match primary key values in the related table 4Referential integrity 5 FK contains a value that refers to an existing valid tuple (row) in another relation 6 Secondary key :Key used strictly for data retrieval检索 purposes

A Logical View of Data

1Relational model :View data logically rather than physically, 2Table :Structural and data independence, Resembles a file conceptually, 3 Relational database model : is easier to understand than hierarchical and network models

Keys - Characteristics

Controlled redundancy: Makes the relational database work,Tables within the database share common attributes 。Enables tables to be linked together。Multiple occurrences of values not redundant when required to make the relationship work。Redundancy exists only when there is unnecessary duplication of attribute values。

The M:N Relationship

Create a composite entity (bridge entity, associative entity), Combine the PKs from both tables into a separate table.

Keys

Each row in a table must be uniquely identifiable, Key: one or more attributes that determine other attributes, Key's role is based on determination, If you know the value of attribute A, you can determine the value of attribute B, Functional dependence:Attribute B is functionally dependent on A ,if all rows in table that agree in value for A also agree in value for B,

The M:N Relationship

Implemented by breaking it up to produce a set of 1:M relationships, Avoid problems inherent to M:N relationship by creating a composite entity, Includes as foreign keys the primary keys of tables to be linked, Tables create too many redundancies, Given the structure of two tables, relational operators become very complex, leads to inefficiency and output errors.

Codd's Relational Database Rules

In 1985, Codd published a list of 12 rules to define a relational database system,Products marketed as "relational" that did not meet minimum relational standards,Even dominant database vendors do not fully support all 12 rules

Choosing a Primary Key

What makes a field a good candidate for a primary key: The data value does not change over time, The data value doesn't contain nulls, A single data element (not compound e.g. "Dawn Owens" versus "Owens")。

The Data Dictionary and System Catalog

Data dictionary : Provides detailed accounting of all tables found within the user/designer-created database,Contains (at least) all the attribute names and characteristics for each table in the system。 Contains metadata: data about data, System catalog Contains metadata, Detailed system data dictionary that describes all objects within the database

Data Redundancy Revisited

Data redundancy leads to data anomalies, Can destroy the effectiveness of the database。 Foreign keys Control data redundancies by using common attributes shared by tables, Crucial to exercising data redundancy control,Sometimes, data redundancy is necessary

Tables and Their Characteristics

Logical view of relational database is based on relation (table), Table: two-dimensional structure composed of rows and columns, Persistent representation of logical relation, Contains group of related entities (entity set)

Integrity Rules

Many RDBMs enforce integrity rules automatically,Safer to ensure that application design conforms 符合规定 to entity and referential有关的 integrity rules 。 Designers use flags to avoid nulls,Flags indicate absence of some value。

The 1:1 Relationship

One entity related to only one other entity, and vice versa。 Sometimes means that entity components were not defined properly, Could indicate that two entities actually belong in the same table, Certain conditions absolutely require their use。

Indexes

Orderly arrangement to logically access rows in a table。 Index key: Index's reference point。 Points to data location identified by the key。 Unique index:Index in which the index key can have only one pointer value (row) associated with it。Each index is associated with only one table。

Relational Set Operators

Relational algebra :Defines theoretical way of manipulating table contents using relational operators,Use of relational algebra operators on existing relations produces new relations:

The 1:M Relationship

Relational database norm: Found in any database environment

Summary

Tables are basic building blocks of a relational database。 Keys are central to the use of relational tables。Keys define functional dependencies。 1Candidate key 2Primary key 3Secondary key 4Foreign key。 Each table row must have a primary key that uniquely identifies all attributes 。 Tables are linked by common attributes。 The relational model supports relational algebra functions。 SELECT, PROJECT, JOIN, INTERSECT UNION, DIFFERENCE, PRODUCT, DIVIDE Good design begins by identifying entities, attributes, and relationships。 1:1, 1:M, M:N


Conjuntos de estudio relacionados

Astronomy II: Test III (quiz questions, practice questions, test questions)

View Set

Chapter 17 - 20 The American Promise

View Set

Chapter Exam: Arizona Laws and Rules

View Set

ch. 6 Memory: Encoding & Storage

View Set

Chapter 1: Computer Networks and The Internet

View Set

Chapter 5 Introduction to Valuation: The Time Value of Money

View Set