Data Base Design

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

DBMS (Prof.

Neil Joshi)

Unit-3
DATA Base Designs
DBMS (Prof. Neil Joshi)

Database Designs
• Database must be WELL-DESIGNED.

• Big and small organizations alike use relational databases to store,


manage, and analyze critical information. But what makes a
database Relational.

• A relational database organizes data in predefined relationships,


letting you easily understand how your data is connected.
DBMS (Prof. Neil Joshi)

Database Designs
Advantages of a Well-Designed Database:

• The database structure is easy to modify and maintain.


• It’s easier to find the information that you need.
• You can avoid redundant, duplicate, and invalid data.
• You can avoid situations where you are missing required
data.
DBMS (Prof. Neil Joshi)

Database Designs
Informal Design Guidelines for Relational Schemas:

• Semantics of relation attributes.


• Reducing the redundant values in tuples.
• Reducing the null values in the tuples.
• Disallowing the possibility of generating spurious tuples.

spurious tuples: Are those rows which arises due to wrong


joining of any two tables.
DBMS (Prof. Neil Joshi)

Database Designs
Semantics of relation attributes:

• Whenever we group attributes to form a relation schema,


we assume that attributes belongs to one relation have
certain real world meaning and a proper interpretation
associated with them.
• The ‘Semantics’ specifies how to interpret the attribute
values stored in a tuple of the relation. Or How the
Attributes in the tuple relates to one another.
DBMS (Prof. Neil Joshi)

Database Designs
Redundant Information in Tuples and Update Anomalies:

• The major goad of schema design is to minimize the


Storage used by the base relation.
• For this the repetition of the entries must be avoided.
• The separate tables can be related by foreign keys instead
of mentioning same attributes again and again in separate
tables.
• Foreign Keys: A column or combination of columns that is used to
establish and enforce a link between the data in two tables to control the data
that can be stored in the foreign key table.
DBMS (Prof. Neil Joshi)

Database Designs
Null Values in Tuples:

• In some schema designs we may group many attributes


together into a “fat” relation. In many of the attributes do
not apply to all the tuples in the relation and finally many
nulls in those tuples occurs.
• This waste the space at the storage level and may also lead
to problems with understanding the meaning of attributes
and with specifying JOIN Operations at the logical level.
DBMS (Prof. Neil Joshi)

Database Designs
Generation of Spurious Tuples:
• Spurious Tuples:
Spurious Tuples are those
rows in a table, which occur
as a result of joining two
tables in the wrong manner.
DBMS (Prof. Neil Joshi)

Database Designs
Summary of Design Guidelines:
The Following parameters must be kept in mind before designing the
database system.
• Anomalies that causes redundant work to be done during insertion into
and modification of relation, and that causes accidental loss of information
during a deletion from a relation.
• To avoid waste of storage space due to nulls and the difficulties performing
operations due to null values.
• Generation of invalid and spurious data during joins on improperly related
base relations.
DBMS (Prof. Neil Joshi)

Functional Dependencies

X→Y
Reads as: ‘Y’ depends on ‘X’

X: Determinant
Y: Dependent
DBMS (Prof. Neil Joshi)

Functional Dependencies
DBMS (Prof. Neil Joshi)

Example:
Functional Dependencies
From the table we can conclude some VALID functional
dependencies:
•roll_no → { name, dept_name, dept_building },
→ Here, roll_no can determine values of fields name, dept_name
and dept_building, hence a valid Functional dependency
•roll_no → dept_name , Since, roll_no can determine whole set of
{name, dept_name, dept_building}, it can determine its subset
dept_name also.
•dept_name → dept_building , Dept_name can identify the
dept_building accurately, since departments with different
dept_name will also have a different dept_building
•: roll_no → name,
•{roll_no, name} {dept_name, dept_building}, etc.
DBMS (Prof. Neil Joshi)

Functional Dependencies
Here are some INVALID functional dependencies:
•name → dept_name Students with the same name can
have different dept_name, hence this is not a valid
functional dependency.
•dept_building → dept_name There can be multiple
departments in the same building. Example, in the above
table departments ME and EC are in the same building B2,
hence dept_building → dept_name is an invalid functional
dependency.
•More invalid functional dependencies:
•name → roll_no,
•{name, dept_name} → roll_no,
•dept_building → roll_no, etc.
DBMS (Prof. Neil Joshi)

Armstrong Axioms of Functional Dependencies


1.Reflexivity: If Y is a subset of X, then X→Y holds by reflexivity rule
Example, {roll_no, name} → name is valid.

2. Augmentation: If X → Y is a valid dependency, then XZ → YZ is


also valid by the augmentation rule.
Example, {roll_no, name} → dept_building is valid, hence
{roll_no, name, dept_name} → {dept_building, dept_name} is also
valid.
3. Transitivity: If X → Y and Y → Z are both valid dependencies, then
X→Z is also valid by the Transitivity rule.
Example, roll_no → dept_name & dept_name → dept_building, then
roll_no → dept_building is also valid.
DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


1.Trivial functional dependency

2.Non-Trivial functional dependency

3.Multivalued functional dependency

4.Transitive functional dependency


DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


Trivial Functional dependency
DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


Non-Trivial Functional dependency
DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


Multivalued Functional dependency
DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


DBMS (Prof. Neil Joshi)

Types of Functional Dependencies


DBMS (Prof. Neil Joshi)

Advantages of Functional Dependencies


DBMS (Prof. Neil Joshi)

Advantages of Functional Dependencies

You might also like