DBMS 1 Chapter
DBMS 1 Chapter
* Representational data models represent data by using record structures and hence
are sometimes called record-based data models.
* self-describing data models The data storage in systems based on these models
combines the description of the data with the data values themselves.
valid state—that is, a state that satisfies the structure and constraints specified in
the schema
Three-Schema Architecture and Data Independence :
* The internal level has an internal schema, which describes the physical
storage structure of the database. The internal schema uses a physical data
model and describes the complete details of data storage and access paths for
the database.
* The conceptual level has a conceptual schema, which describes the structure
of the whole database for a community of users.
* The conceptual schema hides the details of physical storage structures and
concentrates on describing entities, data types, relationships, user operations, and
constraints.
* Usually, a representational data model is used to describe the conceptual schema
when a database system is implemented.
1.Relationship Type:
A relationship type is a category of association between two or more entity types. It
describes how entities are related to each other.
Examples of relationship types include "Works For," "Owns," or "Manages." Each
relationship type has a name that describes the nature of the association.
2.Relationship Set:
A relationship set is a collection of similar relationships. It represents the actual
instances (associations) between entities participating in a particular relationship
type.
For example, if "Employee" and "Department" are two entity types related by the
"Works For" relationship type, the "Works For" relationship set would consist of
specific instances of employees working for specific departments.
3.Roles:
In a binary relationship (involving two entity types), each entity type may play a
role in the relationship. The role of an entity type in a relationship is defined by its
function within that relationship.
For example, in the "Works For" relationship between "Employee" and
"Department," the "Employee" entity type may play the role of "Employee" while
the "Department" entity type plays the role of "Department."
4.Structural Constraints:
Structural constraints define the rules or conditions that limit the structure of a
relationship set. There are two main types of structural constraints:
* Cardinality Ratio:
The cardinality ratio specifies the number of instances of one entity that can be
related to a single instance of another entity. It is expressed as a ratio, such as 1:1,
1:N (one-to-many), or M:N (many-to-many).
* Participation Constraint:
The participation constraint specifies whether every instance of an entity type must
participate in a relationship. It can be total or partial. In a total participation, every
entity in the entity type must participate in the relationship, while in partial
participation, participation is optional.
Let's illustrate these concepts with an example:
Example: "Works For" Relationship
Relationship Type: Works For
Entities Involved: Employee, Department
Relationship Set: Instances of specific employees working for specific
departments.
Roles: Employee (plays the role of Employee), Department (plays the role of
Department).
DATABSE DESIGN
1.Making Sure That The Semantics Of The Attributes Is Clear In The Schema
:
*The semantics of a relation refers to its meaning resulting from the
interpretation of attribute values in a tuple.
Guideline 1.
* Do not combine attributes from multiple entity types and relationship types into a
single relation. Intuitively, if a relation schema corresponds to one entity type or
one relationship type, it is straightforward to explain its meaning.
Otherwise, if the relation corresponds to a mixture of multiple entities and
relationships, semantic ambiguities will result and the relation cannot be easily
explained.
1NF disallows relations within relations. The only attribute values permitted by
1NF are single atomic values.
14.3.5 Second Normal Form :
Definition. A relation schema R is in 2NF if every nonprime attribute A in R is
fully functionally dependent on the primary key of R.
R1(A, B)
R2(B, C, D)
Now, both R1 and R2 satisfy BCNF.