1 Enhanced Entity Relationship Model And Relational Model

Advanced Database · Unit 1 · 8 hrs

Enhanced Entity Relationship Model and Relational Model

Exam-focused notes for Enhanced Entity Relationship Model and Relational Model (Advanced Database, CSC475): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.

Enhanced Entity Relationship Model and Relational Model in short

This unit extends the entity relationship model into the Enhanced ER (EER) model, which adds subclasses, specialization, generalization, union types and aggregation for modeling complex structures, and then shows how both the plain ER model and the EER model are mapped down into relational tables.

Enhanced Entity Relationship Model and Relational Model: notes

Entity Relationship Model Revisited

The E-R model describes the logical view of a system from a data perspective through an entity (an object with independent existence, such as a particular employee), an entity type (a collection of similar entities sharing the same attributes), and an entity set (the actual collection of entities of a type present at some moment). Each entity is described by attributes, and a key (super, candidate, primary, composite, foreign) identifies entities uniquely and links relations together. These constructs are the vocabulary the EER extensions below build on.

Subclasses, Superclasses and Inheritance

Many entity types have meaningful subgroups with their own attributes and relationships that plain ER modeling cannot express. A superclass is an entity type whose entities are grouped into one or more subclasses, each a subset of the superclass sharing extra, subclass-specific properties. The link is drawn as an ISA relationship, and every subclass entity inherits all attributes and relationship participation of its superclass plus its own local attributes. A Shape superclass, for instance, may have Square, Circle and Triangle as subclasses: each inherits Shape's attributes (area, colour) and adds its own (side, radius). An entity cannot exist merely as a member of the superclass; it exists as a member of some subclass.

Specialization and Generalization

Specialization is the top-down process of splitting a superclass into subgroups based on a distinguishing characteristic, for example Employee specialized into Developer and Tester. Generalization is the bottom-up reverse: several existing entity types sharing common attributes are merged into one higher-level superclass, for example Tiger, Lion and Elephant generalized into Animal. Specialization starts from one type and splits it; generalization starts from several types and merges what they share. A superclass can have several specializations at once, on different distinguishing attributes, forming a lattice in which a subclass may itself be further specialized or belong to more than one superclass (multiple inheritance).

Constraints and Characteristics of Specialization and Generalization

Two independent constraints govern a specialization. The completeness (participation) constraint asks whether every superclass entity must belong to some subclass: total specialization requires it (every Student is Graduate or Undergraduate); partial specialization allows superclass entities in no subclass (a University_Member may be neither Staff nor Student). The disjointness constraint asks whether an entity can belong to more than one subclass at once: disjoint, marked {disjoint} (or d), means the subclasses share no entities (Graduate/Undergraduate); overlapping, marked {overlapping} (or o), permits membership in several at once (Person specialized into Employee and Student, since one person can be both). The two constraints combine into four labels: total-disjoint, partial-disjoint, total-overlapping, partial-overlapping.

What this unit covers

  • Entity Relationship Model Revised
  • Subclasses, Superclasses and Inheritance
  • Specialization and Generalization
  • Constraints and characteristics of specialization and Generalization
  • Union Types
  • Aggregation
  • Relational Model Revised
  • Converting ER and EER Model to Relational Model
  • SQL and Advanced Features
  • Concepts of File Structures, Hashing, and Indexing

Constraints and characteristics of specialization and Generalization

2081 · 5 marks

Explain different constraints of specialization and generalization. [5]

Specialization and Generalization are key concepts in the Enhanced Entity-Relationship (EER) model. There are two main constraints that apply to both specialization and generalization: --- This constraint specifies whether every entity in the superclass must participate as a member of at least on...

Open this answer on its own page →

2079 · 10 marks

Design an EER model for library management system having generalization and specialization hierarchies. The EER model should have disjoint and overlapping constraints with at least one of the entities having total participation. Use your own assumption for other concepts. Now convert the EER diagram into its equivalent relational model.[10]

  • A Person is the superclass with two subclasses: Member and Staff (Generalization hierarchy, Disjoint -- a person is either a member or staff, not both) - A LibraryItem is the superclass with subclasses: Book, Journal, and DVD (Specialization hierarchy, Overlapping -- an item can be both a Book ...
Open this answer on its own page →

Concepts of File Structures, Hashing, and Indexing

2081 · 5 marks

What is hashing? How does hashing improve database efficiency? [5]

Show solved answer

Hashing in Database Systems

Definition of Hashing

Hashing is a technique used to search the location of desired data on disk. It uses a mathematical function called a hash function to calculate the direct location (address) of a data record stored in data blocks (also called data buckets) on disk, without the need for indexing.

The hash function can select any column value to generate the address of the data block, but it usually uses the primary key to generate the address.

Formula concept:

Hash Address = hash_function(key value)

How Hashing Improves Database Efficiency

1. Direct Record Access

In large databases, searching through all indexes to find required data is time-consuming. Hashing allows the system to directly compute the disk address of a data record, eliminating the need to scan indexes or perform sequential searches.

2. Faster Data Retrieval

Since the hash function immediately points to the location of the data block, records are retrieved much faster compared to traditional search methods. This directly reduces query execution time.

3. Works Well for Large Databases

Unlike indexing, which does not work well for large databases, hashing works well for large databases because the hash function provides a constant-time lookup regardless of the size of the data.

4. Reduced Disk I/O

By jumping directly to the correct data bucket, hashing minimizes the number of disk read operations, which reduces disk I/O overhead and improves overall system performance.

5. Types of Hashing for Flexibility

Hashing supports two types:

  • Static Hashing: Fixed number of buckets; suitable when data size is known.
  • Dynamic Hashing: Buckets grow or shrink as data changes; suitable for dynamic datasets.

Comparison: Indexing vs Hashing

FeatureIndexingHashing
Large DatabaseDoes not work wellWorks well
Search MethodData reference / addressMathematical hash function
Access TypeSequential / tree-basedDirect address computation

Summary

Hashing improves database efficiency by providing direct, fast, and computed access to data records on disk using a hash function, thereby reducing search time, minimizing disk I/O, and improving overall database performance especially for large-scale systems.

Open this answer on its own page →

2080 · 5 marks

Why hashing is important to store data in databases? What is primary file organization? [5]

--- Hashing is a technique that allows searching for the location of desired data on disk. It uses a mathematical function called a hash function to calculate the storage location of data records. - In large databases, it is not possible to search all the indexes to obtain the required data. Hash...

Open this answer on its own page →

2079 · 5 marks

Why indexing is important to store data in database? What's multilevel index? [5]

Show solved answer

Importance of Indexing in Database and Multilevel Index


Why Indexing is Important (2.5 marks)

When executing SQL queries, it takes some amount of time to access data from the disk. An index is a data structure that helps to find and access data in a table of a database quickly. Indexing technique reduces the number of disk accesses required to process queries.

The key reasons why indexing is important are:

ReasonExplanation
Faster Data RetrievalIndex allows the database engine to locate data without scanning every row in a table
Reduced Disk I/OFewer disk accesses are needed, which significantly speeds up query execution
Query OptimizationIndexing is one of the core optimization techniques that minimizes CPU usage, disk I/O, and network traffic
ScalabilityHelps the system handle growing workloads while maintaining consistent performance
Efficient SearchingOrdered indexing sorts data, making searching faster and more structured

Without indexing, the database would perform a full table scan for every query, which is extremely slow for large databases.


Multilevel Index (2.5 marks)

Definition

A multilevel index is an indexing scheme where the index itself is further indexed at multiple levels, creating a hierarchy of indexes. It is used when a single-level index becomes too large to fit in memory or becomes inefficient to search.

Why Multilevel Index is Needed

  • In a large database, it is not possible to search all the indexes at once to obtain the required data.
  • A single-level index on a very large table can itself become very large, making the index search slow.
  • Multilevel indexing solves this by creating an index over the index, reducing the search space at each level.

Structure

Level 3 (Top/Outer Index) --> very small, fits in memory
        |
Level 2 (Intermediate Index)
        |
Level 1 (Inner/Base Index)
        |
   Actual Data Blocks
  • Level 1 (Primary Index): Index on the actual data file.
  • Level 2 (Secondary Index): Index on the Level 1 index, further reducing search space.
  • Level 3 and beyond: Further levels are added as needed until the top-level index fits in a single disk block or memory.

Key Points

  • Each level reduces the number of entries to be searched.
  • The top-level index is small enough to be loaded into main memory.
  • Multilevel indexing is the foundation of B-Tree and B+ Tree index structures commonly used in DBMS.
  • Secondary indexing contains another level of indexing to minimize the size of mapping, which is a basic form of multilevel indexing.

Example

If a table has 1,000,000 records and each index block holds 100 entries:

  • Level 1 index: 10,000 blocks
  • Level 2 index: 100 blocks
  • Level 3 index: 1 block (fits in memory)

This reduces disk accesses from potentially 1,000,000 to just 3 levels, demonstrating the efficiency of multilevel indexing.


In summary, indexing is critical for fast and efficient data retrieval in databases, and multilevel indexing extends this concept to handle very large datasets by organizing indexes in a hierarchical manner, minimizing disk accesses at every level.

Open this answer on its own page →

Specialization and Generalization

2080 · 10 marks

Explain different features of enhanced ER(EER) model. Compare specialization with generalization.[10]

--- The traditional ER model is not sufficient for representing new, complex database applications such as: - Engineering design and manufacturing (CAD/CAM) - Telecommunications systems - Geographic Information Systems (GIS) To address these limitations, the Enhanced ER (EER) Model was developed....

Open this answer on its own page →

Aggregation

2080 · 5 marks

Explain aggregation with suitable example. [5]

Aggregation is a feature in the Enhanced Entity-Relationship (EER) model that allows a relationship set to participate in another relationship set. It is used when we need to express a relationship between a relationship and an entity, which cannot be represented directly in the basic ER model. I...

Open this answer on its own page →

2079 · 5 marks

What is aggregation? Explain with example. [5]

Aggregation is an abstraction concept in the Entity-Relationship (ER) model where a relationship itself is treated as a higher-level entity. It is used when a relationship between entities needs to participate in another relationship. In other words, aggregation allows a relationship set to be tr...

Open this answer on its own page →