關係數據庫知識

By 1980, enough was known about the relational model for Codd to identify three principle
components:

The structural component

The integrity component

The manipulative component

 

 

The Information Principle
The first rule, called the Information Rule, is also known as the Information Principle. It is
defined as follows:
1. The Information Rule. All information in a relational data base is represented
explicitly at the logical level and in exactly one way—by values in tables.
Date summarizes this rule as follows:
The entire information content of the database is represented in one and only one way,
namely as explicit values in column positions in rows in tables.

 

 

The logical level is made up of more than relations. It is made up of tables, rows, columns, and
types. In relational parlance, these are often referred to more formally as relation variables, tuples,
values, and domains, respectively. SQL, for example, uses many of the former, and relational
theory tends to use many of the latter.

 

A tuple is a set of values, each of which has an associated attribute. An attribute defines a value’s
name and domain. The attribute’s name is used to identify the value in the tuple, and its domain
defines the kind of information stored within it. The combination of attribute and value is called
a component.

 

The group of collective attributes in a tuple is called its heading.

 

A relation, simply enough, is a set of one or more tuples that share the same heading.

 

A tuple is similar to a C structure.

 

Similarly, a tuple’s values are analogous to an instance of a C structure.

 

A relation is the C equivalent of an array of structures.

 

The bottom line is that relations and tuples are highly structured. Furthermore, this structure
is defined by their common heading.

 

Associated with tuples and relations are the notions of degree and cardinality. These are just
fancy words for width and height, respectively.

 

Associated with tuples and relations are the notions of degree and cardinality. These are just
fancy words for width and height, respectively. You could say a relation’s width is the number
of attributes in its heading. This is called the degree. Its height is the number of tuples it contains;
this is called cardinality.

 

While tuples don’t have cardinality, they nonetheless have their own fancy terms. A tuple of degree 1 is said to be a unary tuple. Tuples of degree 2, 3, and 4 are said to be binary, ternary, and quaternary, respectively. Generally, a tuple of degree N is said to be an N-ary tuple. In fact, the word tuple is taken from the N-ary form. In the strictest sense, a unary tuple is called a monad, a binary tuple a pair, a ternary tuple a triple, a quaternary tuple a tetrad, and so on, as shown in Table 3-1.

 

As with tuples, a relation composed of binary tuples is a binary relation. A relation composed of N-ary tuples is an N-ary relation, and so forth.

 

That is a mathematical relation: any subset of a cross project.

 

Domains (or attributes) are uniquely identifiable through attribute names. Therefore, both column and row order do not matter in the relational model. This is the principal way in which the relations of set theory and the relations of relational theory differ.

 

A relation is a value, like an integer value is 1, 2, or 3. A table is a variable—to which relations are assigned.Tables, like variables, have both a name and a value. Their name is just a symbol. Their value is a relation. Tables share all the properties of relations(heading, degree, cardinality, etc.) just as integer variables share the properties of integers.

Views are virtual tables. They look like tables and act like tables, but they’re not. Views are relational expressions that yield relations.

 

 

The main application for views was facilitating what is called logical data independence, which is defined as follows:
   Logical Data Independence: Application programs and terminal activities remain logically unimpaired when information-preserving changes of any kind that theoretically permit un-impairment are made to the base tables.

More precisely, logical data independence means that users and applications should be able to be insulated from changes at the logical level of the database.

 

Codd’s second rule is the starting point of data integrity, and deals with the nature of data within relations. This rule is called the Guaranteed Access Rule and is defined as follows:

 Guaranteed Access Rule:Each and every datum (atomic value) in a relational data base is guaranteed to be logically accessible by resorting to a combination of table name, primary key value and column name.

 

The primary key is the set of attributes in a relation that uniquely identifies each tuple within it.

 

A key is a designated attribute (or group of attributes) in a relation such that
1. The value (or combined values) of that attribute (or attributes) is unique for every tuple
in the relation.
2. If the key is composed of more than one attribute, all of the attributes that define the
key must be necessary to ensure uniqueness. That is, every attribute in the key is sufficient
to ensure uniqueness, but also necessary as well—if one were absent, then the uniqueness
condition would not hold.
If both conditions 1 and 2 are met, then the resulting attribute or group of attributes is a key
(also called a candidate key). If condition 1 is met but not condition 2, then the attribute (or
group of attributes) is called a superkey. It is a key that could stand to lose some weight. That is,
it has more attributes than necessary to ensure uniqueness: a smaller key containing fewer
attributes could be defined that still guarantees uniqueness.

 

In the relational model, constraints fall into four general classes of integrity:

Domain integrity

Entity integrity

Referential integrity

User-defined integrity

NULL VALUE

3. Systematic Treatment of Null Values. Null values (distinct from the empty character
string or a string of blank characters and distinct from zero or any other number) are
supported in fully relational DBMS for representing missing information and inapplicable
information in a systematic way, independent of data type.

 

Normalization

The implication of no duplicate tuples provided by the Guaranteed Access Rule gives rise to an
important concept in database design called normalization. Normalization concerns itself
with the organization of attributes within relations so as to minimize duplication of data.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章