Skip to main content

Fundamentals

Database vs DBMS

A database does not provide tools to interact with data efficiently, DBMS does.

FeatureDatabase (DB)DBMS (Database Management System)
DefinitionCollection of structured data.Software to manage and interact with the database.
NaturePassive (just stores data).Active (manages, controls, secures, and queries data).
ContentOnly contains raw data.Contains programs, rules, and tools to handle data.
User InteractionUsers cannot directly interact easily.Provides interface (like SQL) for users/applications.
SecurityNot provided by database itself.Provides authentication, authorization, backups.
ExampleStudent Records stored in tables/files.MySQL, Oracle, PostgreSQL managing those records.

Types of Databases

Relational Database (RDB)

  • Stores data in tables (rows and columns).
  • Relationships between tables are established using keys (Primary Key, Foreign Key).
  • Managed by Relational Database Management Systems (RDBMS) like MySQL, Oracle, PostgreSQL, SQL Server.
  • Uses SQL (Structured Query Language) for queries.

Example:

students

student_idnamedeptphone
S101AminaCSE01711111111

courses

course_idcourse_namecredit
C201Database Sys.3
  • Relationship: students enroll in courses via a join table (Enrollment).

NoSQL Database

  • “Not Only SQL” – used when data is unstructured or semi-structured (JSON, XML, documents, key-value pairs).
  • Designed for scalability, flexibility, and big data.
  • Types:
    • Document-based (MongoDB, CouchDB)
    • Key-Value Store (Redis, DynamoDB)
    • Column-based (Cassandra, HBase)
    • Graph-based (Neo4j)

Example:

A product entry in JSON format:

{
"product_id": "P101",
"name": "Laptop",
"price": 700,
"reviews": [
{ "user": "Amina", "rating": 5 },
{ "user": "Rahim", "rating": 4 }
]
}

Flexible for data that changes frequently (reviews, social media posts).

Distributed Database

  • A single logical database that is spread across multiple locations/servers.
  • Can be homogeneous (same DBMS everywhere) or heterogeneous (different DBMS).
  • Increases availability, performance, and reliability.

Example: Banking System

  • Customer data stored in Dhaka branch server.
  • Transaction data stored in Chittagong branch server.
  • A central DBMS coordinates queries across all servers.

Ensures high availability & quick access for global organizations.

Cloud Database

  • Database that runs on a cloud platform (AWS RDS, Google Cloud SQL, Azure SQL).
  • Provides scalability, pay-as-you-go pricing, automatic backup.
  • Accessible from anywhere via internet.

Example: Netflix

  • Stores millions of user profiles, watch history, and recommendations in cloud databases.
  • Scaling is automatic when user demand spikes.

Best for web/mobile apps that need global access.

Object-Oriented Database

  • Stores data as objects (similar to object-oriented programming).
  • Each object has attributes (data) and methods (functions).
  • Example systems: db4o, ObjectDB.

Example: Multimedia Application

  • A "Video" object contains:
  • Attributes: Title, Duration, Size.
  • Methods: play(), pause(), stop().

Great for applications needing complex data types like images, audio, video

Why is Database Design Important?

  1. Eliminates Data Redundancy
  2. Ensures Data Integrity & Consistency
  3. Improves Query Performance
  4. Supports Scalability
  5. Enhances Security & Access Control
  6. Facilitates Maintenance & Updates
  7. Enables Better Decision-Making