How unit 2 is examined
This unit covers the data models used to describe a database; the marks sit on the relational model (properties of a relation) and the E-R model (constraints, generalization and specialization), with one question on the types of data model.
Data Model and Types of Data Model
Low weight
Definition. A data model is a collection of concepts for describing the data, the relationships among data, the semantics and the constraints of a database.
Key points.
- The hierarchical model stores data as a tree of parent-child records, where each child has exactly one parent.
- The network model stores records as a graph, so a child may have many parents, linked by pointers (sets).
- The relational model stores data as tables (relations) of rows and columns linked by common attribute values.
- The E-R model is a high-level conceptual model that describes entities, attributes and relationships as a diagram.
- Object-oriented and object-relational models store data as objects with attributes and methods; the associative model stores entities and associations as separate items.
Asked: [7 marks] (Jun 2020) Explain various types of Data models in brief.
Relational Data Model
Medium weight
Definition. The relational model, proposed by E. F. Codd, represents data as relations; a relation is a table whose rows are tuples and whose columns are attributes.
Key points.
- A relation has a unique name, and every column (attribute) in it has a unique name.
- Column homogeneity: all values in a column come from the same domain, for example every value of Age is an integer.
- Every value is atomic and single-valued, so a cell cannot hold a list or a repeating group.
- Tuples are unique, so a relation has no duplicate rows and a key identifies each tuple.
- The order of tuples does not matter, because a relation is a set of tuples.
- The order of attributes does not matter, because columns are identified by name and not by position.
- The schema $R(A_1, A_2, \dots, A_n)$ gives the relation name and attributes; the number of attributes is its degree and the number of tuples its cardinality.
Example.
| RollNo | Name | Branch |
|---|---|---|
| 101 | Asha | CS |
| 102 | Ravi | IT |
A relation is a table of atomic values with a unique name, uniquely named columns, unique tuples and no significance to row or column order.
Answer frame. Open with the definition of a relation; draw the small STUDENT table; develop points 1-7 in order; close with the highlighted sentence.
Pitfall: Do not say tuples are ordered; a relation is a set, so row order carries no meaning.
Asked: [7 marks] (Dec 2020, Jun 2020) Describe the properties of a relation.
Hierarchical Model
Not asked since 2022
Definition. The hierarchical model organises data as a tree of records in which each child record has exactly one parent.
Key points.
- Relationships are one-to-many from parent to child, and access starts at the root and moves down.
- It is fast for fixed queries, but many-to-many relationships need duplicated records.
- Insertion, deletion and restructuring are rigid, since deleting a parent deletes its children (IBM IMS is an example).
Network Data Model
Not asked since 2022
Definition. The network model organises records as a graph in which a child record can have more than one parent, linked through sets of pointers.
Key points.
- It supports many-to-many relationships directly without duplicating records.
- Records are connected by owner-member sets, and access follows pointers (CODASYL DBTG model).
- It is more flexible than the hierarchical model, but the pointer structure is complex to design and change.
Object/Relational Model
Not asked since 2022
Definition. The object/relational model (ORDBMS) extends the relational model with object features such as user-defined types, methods, inheritance and nested tables.
Key points.
- Data is still stored in tables and queried with SQL, which is extended for objects.
- Columns may hold complex types such as arrays or user-defined types.
- It keeps relational compatibility while giving some object power (Oracle and PostgreSQL are examples).
Object-Oriented Model
Not asked since 2022
Definition. The object-oriented model (OODBMS) stores data as objects that bundle attributes with methods and belong to classes.
Key points.
- It supports encapsulation, inheritance, polymorphism and object identity.
- Complex data such as images and CAD designs is stored naturally, without joins.
- It suits programs in object languages, but it has no single standard query language and a smaller user base.
Entity-Relationship Model
Medium weight
Definition. The E-R model describes a database as entities (things), their attributes and the relationships among them, drawn as an E-R diagram.
Key points.
- Cardinality constraint gives how many entities relate: one-to-one, one-to-many, many-to-one or many-to-many.
- Participation constraint is total if every entity must take part in the relationship, else partial.
- Key constraint: a key attribute uniquely identifies each entity in a set.
- Domain constraint: each attribute takes values only from its permitted set of values.
- Generalization is bottom-up: common features of several lower-level entity sets are combined into a superclass.
- Specialization is top-down: a superclass is divided into subclasses with extra attributes; subclasses inherit all attributes of the superclass, shown with an IS-A triangle.
Diagram.
Generalization combines entity sets bottom-up into a superclass, and specialization splits a superclass top-down into subclasses that inherit its attributes.
Answer frame. For generalization: open with both definitions, draw the Person tree, contrast direction and use, close with inheritance. For constraints: open with entity, relationship and attribute, draw the works-for diagram, develop points 1-4, close with the diagram.
Asked: [7 marks] (Dec 2020) Define generalization and specialization with the help of suitable diagram. Asked: [7 marks] (Jun 2020) Explain about various constraints used in E-R model.
Modeling using E-R Diagrams
Not asked since 2022
Definition. E-R modeling is designing a database by identifying entities, attributes and relationships and drawing them as a diagram.
Key points.
- First list the entity sets, then their attributes and key attributes.
- Next add relationships with their cardinality and participation.
- Finally convert the diagram to tables: entity to table, many-to-many relationship to its own table.
Notation used in E-R Model
Not asked since 2022
Definition. Chen notation draws each E-R element with a fixed symbol.
Key points.
- Rectangle is an entity set; double rectangle is a weak entity.
- Ellipse is an attribute; underlined ellipse is a key; double ellipse is multivalued; dashed ellipse is derived.
- Diamond is a relationship; lines join the parts and carry 1, N or M.
Associative Database Model
Not asked since 2022
Definition. The associative model stores data as two kinds of items: entities and associations that link them.
Key points.
- Each association is a triple of source, verb and target, for example (Asha, studies, DBMS).
- It avoids null values and separates schema from data.
- It is rarely used, and Sentences and Lazy DB are its examples.
Last-minute revision
- A data model describes data, relationships, semantics and constraints.
- Hierarchical is a tree (one parent); network is a graph (many parents).
- A relation is a table: rows are tuples, columns are attributes.
- Relation properties: unique names, one domain per column, atomic values, unique tuples, no order.
- Degree is the number of attributes; cardinality is the number of tuples.
- E-R constraints: cardinality, participation, key, domain.
- Generalization is bottom-up; specialization is top-down.
- Subclasses inherit superclass attributes through IS-A.
- ORDBMS extends tables with objects; OODBMS stores objects.
- Chen notation: rectangle, ellipse, diamond.
Memory hooks
- HNROA: Hierarchical, Network, Relational, Object, Associative.
- GEN goes up (bottom-up), SPEC goes down (top-down).
- Relation properties: "A-U-U-N": Atomic, Unique tuples, Unique names, No order.
- Chen: Rectangle = thing, Ellipse = detail, Diamond = link.
Coverage checklist
- Data Model and Types of Data Model: Q Jun 2020 types of data models.
- Relational Data Model: Q Dec 2020, Jun 2020 properties of a relation.
- Hierarchical Model: no past questions.
- Network Data Model: no past questions.
- Object/Relational Model: no past questions.
- Object-Oriented Model: no past questions.
- Entity-Relationship Model: Q Dec 2020 generalization and specialization; Q Jun 2020 E-R constraints.
- Modeling using E-R Diagrams: no past questions.
- Notation used in E-R Model: no past questions.
- Associative Database Model: no past questions.