--:-- --
↓ Scroll for more

Unit 5.4

An Introduction to Database Models

IT 231: IT and Application

Learning Objectives 🎯

By the end of this chapter, you will be able to:

  • βœ… Define a database model.
  • βœ… Describe the hierarchical and network models.
  • βœ… Explain the structure of the relational model.
  • βœ… Understand the importance of the relational model in modern databases.

What is a Database Model?

A database model is a set of rules and standards that defines the logical structure of a database.

It determines how data is stored, organized, and manipulated.

Think of it as the blueprint for a database. πŸ“

A Look Back: Early Database Models

Before the modern relational model became standard, data was organized differently. Let's explore two influential early models.

1. Hierarchical Model

2. Network Model

1. The Hierarchical Model 🌳

This model organizes data in a rigid, tree-like structure.

Key Features

  • Data is structured like an organization chart.
  • There is a single "root" at the top.
  • Each "child" record has only one parent.

Major Disadvantage

  • Very inflexible.
  • To access data, you must start at the root and navigate down the tree.

2. The Network Model πŸ•ΈοΈ

An evolution of the hierarchical model, offering more flexibility.

Key Features

  • Data is in a graph-like structure.
  • A "child" record can have multiple parent records.
  • This allows for more complex relationships.

Major Disadvantage

  • While more flexible, it was still very complex to navigate and manage.

The Game Changer: Relational Model ⚑

Developed by E.F. Codd in 1970, this model revolutionized how we think about data.

The relational model is the basis for almost all modern database systems we use today, including MySQL, PostgreSQL, and SQL Server.

How the Relational Model Works πŸ“Š

It organizes data into simple, two-dimensional tables (also called relations).

Tables

Store data about a specific entity (e.g., `Students`, `Courses`).

Rows (Records)

Represent a single instance of that entity (e.g., one specific student).

Columns (Fields)

Represent an attribute of that entity (e.g., `FirstName`, `CourseID`).

Visualizing Relational Tables

Imagine a simple database for our university.

Table: `Students`


| StudentID | FirstName | LastName |
|-----------|-----------|----------|
| 101       | Anjali    | Thapa    |
| 102       | Bikash    | Shrestha |
    

Table: `Enrollments`


| EnrollmentID | StudentID | CourseID |
|--------------|-----------|----------|
| 1            | 101       | IT231    |
| 2            | 102       | IT231    |
    

Tables are linked together using common fields called keys (like `StudentID`).

Accessing the Data: SQL πŸ”

The power of the relational model is unlocked with a special language.

SQL (Structured Query Language) is the standard language for managing and querying data in relational databases.

It allows for powerful, flexible, and easy-to-understand data manipulation.


SELECT FirstName FROM Students WHERE StudentID = 101;
-- Result: Anjali
  

Practical Application in Nepal

Relational databases power many systems we use daily.

Digital Wallets (eSewa, Khalti)

They use tables for `Users`, `Transactions`, and `Merchants`. Your transaction history is linked to your User ID, which is a key in the `Transactions` table.

Government Services (Nagarik App)

Integrates data from different government bodies. It likely has tables for `Citizens`, `Documents` (like citizenship, PAN), and `Services`, all linked by a unique Citizen ID.

Summary & Key Takeaways

  • A database model is the logical blueprint of a database.
  • Early models like Hierarchical (tree) and Network (graph) were influential but rigid and complex.
  • The Relational Model is the modern standard, using simple, flexible tables made of rows and columns.
  • SQL is the standard language used to query and manage data in relational databases.

Thank You!

Any Questions?

Next Topic: Chapter 5: Database Management Systems (DBMS)

Back to IT 231 Course Notes