Database Models

Database Models Comparison

FeatureHierarchical ModelNetwork ModelRelational ModelObject-Oriented Model
StructureTree-like structureWeb-like structure (graph)Tables with rows & columnsObjects with data & methods
RelationshipOne-to-many (parent-child)Many-to-manyFlexible, using keysComplex relationships
AnalogyFamily Tree 🌳Spider’s Web 🕸️Excel Spreadsheets 🧾Real-world Objects 🚗
Key AdvantageFast for specific queriesMore flexible than HierarchicalVery flexible & easy to useHandles complex data well
Key DisadvantageVery rigid, can’t do many-to-manyCan be very complexSlower for some queriesNot widely used for business
ExamplesFile systems, IBM Information Management System (IMS)Integrated Data Store (IDS), IDMSMySQL, PostgreSQL, OracleGemStone, ObjectDB

Quick Notes:

  1. Hierarchical and Network Models are older models focusing on rigid structures.
  2. Relational Model is widely used and supports SQL.
  3. Object-Oriented and Document Models are ideal for modern applications.
  4. Graph and Time-Series Models are specialized for specific use cases like relationships and logs.

MCQ

Which database model organizes data in a tree-like structure with parent-child relationships?
A) Relational Model
B) Hierarchical Model
C) Network Model
D) Graph Model

Answer: B

In which database model are relationships defined using primary and foreign keys?
A) Network Model
B) Document Model
C) Relational Model
D) Key-Value Model

Answer: C

Which database model is best suited for applications requiring many-to-many relationships?
A) Hierarchical Model
B) Network Model
C) Key-Value Model
D) Columnar Model

Answer: B

In the Document Model, data is commonly stored in which formats?
A) CSV and TSV
B) JSON and XML
C) PDF and TXT
D) SQL and HTML

Answer: B

Which database model is best for unstructured or semi-structured data?
A) Relational Model
B) Document Model
C) Hierarchical Model
D) Network Model

Answer: B

For a social network application, which database model is most suitable to represent relationships?
A) Graph Model
B) Relational Model
C) Key-Value Model
D) Columnar Model

Answer: A

Which database model is optimized for analytics and large-scale queries?
A) Columnar Model
B) Key-Value Model
C) Time-Series Model
D) Object-Oriented Model

Answer: A

Which of the following database models is commonly used for caching due to its simplicity and speed?
A) Document Model
B) Relational Model
C) Key-Value Model
D) Graph Model

Answer: C

In the Hierarchical Model, each child node:
A) Can have multiple parents
B) Can have only one parent
C) Cannot have any parent
D) Has no restrictions on relationships

Answer: B

Which database model stores data as objects with attributes and methods?
A) Object-Oriented Model
B) Columnar Model
C) Document Model
D) Time-Series Model

Answer: A

Which database model is specifically designed to handle geographic and spatial data?
A) Time-Series Model
B) Spatial Model
C) Relational Model
D) Document Model

Answer: B

For metrics and logs organized by timestamps, which database model is most appropriate?
A) Graph Model
B) Time-Series Model
C) Network Model
D) Key-Value Model

Answer: B