Uploaded by Nway Nway Wint Aung

6final (14 files merged)

advertisement
A weak entity set is an entity that cannot be uniquely identified by its
own attributes and depends on a strong entity set for identification. To
make a weak entity set into a strong entity set, we can add the primary
key of its identifying entity set as an attribute. For example, consider
the weak entity set OrderItem that represents items ordered by customers.
The identifying entity set for OrderItem is Order which is a strong
entity set. The primary key of Order is order_id.
If we add order_id as an attribute to OrderItem, then OrderItem becomes a
strong entity set. The resulting redundancy is that each OrderItem tuple
will have a copy of the order_id attribute, which can lead to data
inconsistency if the same order_id value is not used consistently in all
OrderItem tuples that belong to the same Order.
However, this redundancy may be necessary to simplify queries and
increase performance. For example, if we want to retrieve all the
OrderItem tuples for a particular Order, we can do so efficiently if we
have the order_id attribute in OrderItem. Without the order_id attribute,
we would need to join Order and OrderItem on their common attribute,
which can be more time-consuming.
Therefore, adding the primary-key attributes of the identifying entity
set to a weak entity set can introduce some redundancy, but it may also
improve query performance and simplify data retrieval. It is up to the
database designer to weigh the trade-offs and decide whether to make the
weak entity set into a strong entity set.
Armstrong's axioms are a set of inference rules for deducing functional
dependencies from a set of given functional dependencies. There are three
axioms in Armstrong's axioms: reflexivity, augmentation, and
transitivity.
Reflexivity: If X is a set of attributes in a relation R, then X → X is a
valid functional dependency.
The reflexivity axiom is sound because it is a direct application of the
definition of functional dependency. If X determines itself, then by
definition, any instance of R will satisfy the functional dependency X →
X.
Augmentation: If X → Y is a valid functional dependency in R, and Z is a
set of attributes such that Z ⊆ R, then XZ → YZ is also a valid
functional dependency in R.
The augmentation axiom is sound because it is also a direct application
of the definition of functional dependency. If X determines Y in R, then
it is also true that XZ determines YZ for any subset of attributes Z.
This is because if we know the value of X and Z for a tuple in R, then we
can determine the value of Y and Z for that tuple.
Transitivity: If X → Y and Y → Z are valid functional dependencies in R,
then X → Z is also a valid functional dependency in R.
The transitivity axiom is sound because it follows logically from the
definition of functional dependency. If X determines Y and Y determines
Z, then we can substitute Y with its value determined by X in the
functional dependency Y → Z to obtain X → Z. This is because if we know
the value of X for a tuple in R, then we can determine the value of Y and
Z for that tuple.
Overall, each of Armstrong's axioms is sound because they are all logical
applications of the definition of functional dependency. By applying
these axioms, we can derive new functional dependencies that can help us
better understand and optimize the data in a relational database.
To calculate colonial cover in functional dependency, you need to follow
these steps:
Start with a set of functional dependencies for a relation R.
Identify all the keys of R.
For each key of R, create a minimal cover by eliminating redundant
functional dependencies and transitive dependencies.
For each minimal cover, identify the attributes that can be uniquely
determined by the key.
Combine all the attributes that can be uniquely determined by each key to
create the colonial cover.
The colonial cover is the set of attributes that can be uniquely
determined by all the keys of R.
Here's an example to illustrate the process:
Suppose we have a relation R(A,B,C,D,E) with the following functional
dependencies:
A ->
B ->
C ->
D ->
Step
D, D
B
C
D
E
1: We have the set of functional dependencies {A -> B, B -> C, C ->
-> E}
Step 2: The keys of R are {A,B,C,D}
Step 3: We can create a minimal cover by eliminating redundant functional
dependencies and transitive dependencies:
A -> B
B -> C
C -> D
D -> E
Step 4: For each minimal cover, identify the attributes that can be
uniquely determined by the key:
Key A: B
Key B: C
Key C: D
Key D: E
Step 5: Combine all the attributes that can be uniquely determined by
each key to create the colonial cover:
A ->
B ->
C ->
D ->
A ->
A ->
A ->
Step
B
C
D
E
C
D
E
6: The colonial cover is {A,B,C,D,E}
Therefore, the colonial cover of the given functional dependencies is
{A,B,C,D,E}.
Composite Key: A composite key is a key that consists of two or more
attributes that are combined to form a unique identifier for a relation.
Unlike a simple or single attribute key, a composite key is made up of
multiple attributes. In other words, a composite key is a combination of
candidate keys. For example, a composite key for a relation that stores
information about employees might consist of the employee's first name,
last name, and date of birth.
Alternative Key: An alternative key is a candidate key that is not chosen
as the primary key. In other words, it is a key that could have been
selected as the primary key, but for some reason, a different candidate
key was chosen instead. An alternative key provides an alternative way to
uniquely identify tuples in the relation. For example, in a relation that
stores information about students, the student ID might be the primary
key, while the student's social security number might be an alternative
key.
In summary, a composite key is a key that consists of two or more
attributes, while an alternative key is a candidate key that is not
selected as the primary key. Both composite keys and alternative keys are
important for ensuring data integrity and accuracy in a relational
database.
Yes, that's correct. The Entity-Relationship (ER) model is typically used
to develop the conceptual schema, while the relational model is used to
develop the logical schema. The ER model provides a graphical
representation of the entities, relationships, and attributes of the
database, which can be used to create the conceptual schema. The
relational model, on the other hand, provides a set of rules and
guidelines for representing data in tables, which can be used to create
the logical schema.
In other words, the ER model is used to identify the key entities and
their relationships, while the relational model is used to define the
tables and columns, and the relationships between them. The conceptual
schema is often used as a starting point for designing the logical
schema, which involves transforming the ER diagram into a set of
normalized tables with well-defined relationships and constraints.
Dependency preservation is the concept of maintaining the functional
dependencies that exist in a relation when it is transformed or
normalized to a different schema or structure. The goal of dependency
preservation is to ensure that the logical relationships between the
attributes in the original relation are preserved in the transformed
relation.
When a relation is transformed or normalized, some of the original
functional dependencies may be lost or changed. For example, if a
relation is split into two or more smaller relations, the functional
dependencies between the attributes in the original relation may no
longer hold in the transformed relations. Similarly, if a relation is
joined with another relation, new functional dependencies may arise that
were not present in the original relation.
Dependency preservation techniques aim to mitigate these risks and ensure
that the functional dependencies are preserved as much as possible. Some
common dependency preservation techniques include:
Normalization: This involves decomposing a relation into smaller
relations, while ensuring that the original functional dependencies are
preserved in the new relations.
Join decomposition: This involves splitting a relation into smaller
relations, and then re-joining them to form a new relation, while
preserving the original functional dependencies.
Synthesis: This involves creating a new relation that combines the
attributes and functional dependencies of two or more existing relations.
Overall, dependency preservation is an important aspect of database
design and normalization, as it ensures that the logical relationships
between attributes are maintained and can be used to enforce data
integrity and consistency.
In the context of entity-relationship modeling, a constraint is a rule
that specifies the relationships between entity sets. Two common types of
constraints are disjoint and overlapping constraints.
Disjoint Constraints:
A disjoint constraint specifies that an entity can belong to only one of
the associated entity sets in a relationship. For example, consider a
university database where there are two entity sets: "students" and
"faculty." A disjoint constraint on these entity sets would mean that
each individual can be either a student or a faculty member, but not
both.
Overlapping Constraints:
An overlapping constraint specifies that an entity can belong to more
than one of the associated entity sets in a relationship. For example,
consider a database for a hospital where there are two entity sets:
"patients" and "employees." An overlapping constraint on these entity
sets would mean that an individual could be both a patient and an
employee at the same time.
In summary, disjoint constraints specify that entities can belong to only
one entity set in a relationship, while overlapping constraints allow
entities to belong to multiple entity sets in a relationship. The choice
between using disjoint or overlapping constraints depends on the specific
requirements of the system being modeled.
In database design, specialization is the process of dividing a single
entity into smaller sub-entities that are more specific. For example, a
"vehicle" entity can be specialized into "car" and "motorcycle" subentities. There are two types of specialization: overlapping and
disjoint.
Overlapping specialization means that the sub-entities can have
attributes in common with each other. Using the "vehicle" example, an
overlapping specialization could be "sport" and "luxury" sub-entities,
where some vehicles could belong to both categories. In other words, some
vehicles could be both a sport and luxury vehicle at the same time.
Disjoint specialization, on the other hand, means that the sub-entities
do not have any attributes in common with each other. Using the "vehicle"
example again, a disjoint specialization could be "car" and "motorcycle"
sub-entities, where a vehicle can only belong to one of the categories at
a time. In other words, a vehicle can be a car OR a motorcycle, but not
both at the same time.
In summary, overlapping specialization allows sub-entities to share some
attributes in common, while disjoint specialization requires sub-entities
to have no attributes in common.
In the context of functional dependencies in a relational database, the
terms "holds" and "satisfy" are often used interchangeably to describe
the same concept, but they can have slightly different connotations.
When we say that a functional dependency "holds" for a relation, we mean
that the relationship between the determinant and dependent attributes
exists and is true for every tuple (or row) in the relation. This
emphasizes the fact that the functional dependency is a property of the
data itself and is true regardless of any specific query or operation
that we might perform on the data.
On the other hand, when we say that a functional dependency is
"satisfied" by a relation, we mean that the functional dependency holds
true for all possible values of the attributes in the relation. This
emphasizes the fact that we are checking whether the functional
dependency is true for the entire relation, rather than just for
individual tuples or instances of the relation.
In practice, the terms "holds" and "satisfy" are often used
interchangeably to describe the same concept of functional dependencies
being true for a relation or set of relations.
Low level design in database design is the process of transforming the
high level design of the database into a detailed technical design that
can be used for implementing the database system. This involves designing
the database schema, selecting the appropriate data types and constraints
for each attribute, and defining the relationships between the tables.
Here are some key points to keep in mind when studying low level design
in database management:
Database schema design: The database schema defines the structure of the
database and the relationships between the tables. In low level design,
you will need to create a detailed schema that specifies the attributes,
data types, and constraints for each table in the database.
Normalization: Normalization is the process of organizing the data in the
database to minimize redundancy and improve data integrity. In low level
design, you will need to ensure that the database schema is normalized to
at least third normal form (3NF) to eliminate redundant data.
Data types and constraints: Choosing the appropriate data types and
constraints for each attribute is important for ensuring data accuracy
and consistency. In low level design, you will need to select the
appropriate data types and constraints for each attribute in the database
schema.
Indexing: Indexing is the process of creating indexes on the database
tables to improve query performance. In low level design, you will need
to decide which columns to index and which type of index to use for each
column.
Security and access control: Security and access control are important
aspects of database design. In low level design, you will need to define
the security policies and access controls for the database, including
user roles and permissions.
Overall, low level design in database management involves creating a
detailed technical design for the database that is based on the high
level design. This requires careful consideration of the database schema,
data types and constraints, normalization, indexing, and security and
access control.
low-level view vs high-level view of database
low-level view->implementation state
high-level view->initial phase, conceptual design
Primary Key: A primary key is a specific candidate key that has been
selected as the main identifier for a relation. It is a single attribute
or combination of attributes that is used to uniquely identify each tuple
in the relation. A primary key must be non-null and unique for each tuple
in the relation, and it cannot be changed once it has been assigned. A
relation can have only one primary key.
Candidate Key: A candidate key is a set of attributes that can uniquely
identify each tuple in a relation. It is a minimal set of attributes that
satisfies the uniqueness and non-nullity constraints. A relation can have
multiple candidate keys, and any one of them can be chosen as the primary
key.
Superkey: A superkey is a set of attributes that can uniquely
each tuple in a relation. It may contain more attributes than
key, and therefore, it is not necessarily minimal. A superkey
to create a candidate key by removing unnecessary attributes.
can have multiple superkeys.
identify
a candidate
can be used
A relation
In summary, a primary key is a specific candidate key that is chosen as
the main identifier for a relation, while a candidate key is any minimal
set of attributes that can uniquely identify each tuple in a relation. A
superkey is any set of attributes that can uniquely identify each tuple,
which may include more attributes than a candidate key.
In database design, an entity set is a group of related objects or
concepts that are represented as a single unit. There are two types of
entity sets: weak and strong.
Strong Entity Set:
A strong entity set is an entity set that can be uniquely identified by
its attributes, without relying on any other entity set. In other words,
it has a primary key that can be used to identify each individual entity
in the set. For example, in a database for a university, the student
entity set would be a strong entity set because each student can be
uniquely identified by their student ID.
Weak Entity Set:
A weak entity set is an entity set that cannot be uniquely identified by
its attributes alone, and instead relies on another entity set to do so.
In other words, it has a partial key that is a combination of its own
attributes and the primary key of another entity set. For example, in a
database for a hospital, the patient entity set might be a weak entity
set because each patient might have multiple visits to the hospital, and
the visit number is needed to uniquely identify each visit record.
In summary, the key difference between a strong and weak entity set is
that a strong entity set can be uniquely identified by its own
attributes, while a weak entity set requires the attributes of another
entity set to be uniquely identified.
The process of designating subgroupings
within an entity set is called specialization
In database design, a constraint is a rule that specifies how data can be
stored in a database. Two common types of constraints are total and
partial constraints, which relate to the relationships between entity
sets in a database.
Total Constraints:
A total constraint requires that every entity in one entity set be
associated with at least one entity in another entity set in a
relationship. For example, consider a university database where there are
two entity sets: "students" and "courses." A total constraint on these
entity sets would mean that every student must be enrolled in at least
one course.
Partial Constraints:
A partial constraint allows for the possibility that some entities in one
entity set may not be associated with any entities in another entity set
in a relationship. For example, consider a database for a library where
there are two entity sets: "books" and "borrowers." A partial constraint
on these entity sets would mean that not every book has to be checked out
by a borrower, and not every borrower has to check out a book.
In summary, total constraints require that every entity in one entity set
be associated with at least one entity in another entity set in a
relationship, while partial constraints allow for the possibility that
some entities may not be associated with any entities in another entity
set. The choice between using total or partial constraints depends on the
specific requirements of the system being modeled.
In a relational database, a functional dependency (FD) is a relationship
between two or more attributes in a relation, where the value of one
attribute determines the value of another attribute.
Trivial FDs are those that hold for all possible instances of a relation.
Specifically, a functional dependency X → Y is trivial if Y is already
determined by X, meaning that X and Y have the same set of attributes.
For example, if we have a relation R(A,B,C) with the functional
dependency A → A, then this is a trivial FD because the value of A
already determines itself.
Non-trivial FDs, on the other hand, hold for some but not all possible
instances of a relation. Specifically, a functional dependency X → Y is
non-trivial if Y is not already determined by X. For example, in the
relation R(A,B,C), the functional dependency A → B is non-trivial if
there are some values of A that determine multiple possible values of B.
In general, non-trivial FDs are more interesting and important for
database design and optimization because they express constraints on the
data that can help identify redundancies, inconsistencies, and other
potential issues. Trivial FDs, by contrast, are not particularly useful
for data analysis or optimization because they don't provide any new
information beyond what is already known from the structure of the
relation.
Download