DEV Community

Cover image for DBMS Basics
tanzimsafin
tanzimsafin

Posted on

DBMS Basics

Understanding DBMS: From Data to Database Architecture

What's the Difference Between Data and Information?

Think of it this way: Data is raw, unprocessed facts, while Information is data that has been given meaning.

Simple Example:

  • Data: 10
  • Information: Age: 10 years

The number alone is just data, but when we add context (that it represents someone's age), it becomes useful information.


What is a Database?

A database is simply a collection of related data that's connected in meaningful ways. Think of it like an organized filing cabinet where everything is labeled and linked together.


Why Use Databases Instead of File Systems?

You might wonder, "Can't I just save files on my computer?" Well, you could, but here's why that's problematic:

Problems with File Systems:

Data Redundancy (Duplication)

  • The same information gets saved in multiple places
  • Wastes storage space

Data Inconsistency

  • If you update information in one file but forget to update it in another copy
  • Different files show different information about the same thing

Poor Memory Management

  • No efficient way to organize and retrieve data
  • Everything becomes messy and slow

Weak Security

  • Hard to control who can access what
  • No built-in protection mechanisms

What is RDBMS (Relational Database)?

RDBMS organizes data in a simple table format with rows and columns - just like an Excel spreadsheet, but much more powerful!

Where is RDBMS Used?

  • Schools and colleges (student records, grades)
  • Banks (account information, transactions)
  • Software companies (user data, products)
  • Almost any business that needs to store data!

Popular Database Types:

  • SQL databases (like MySQL, PostgreSQL)
  • NoSQL databases (like MongoDB)
  • Object-oriented databases
  • In-memory databases
  • Blockchain databases

Most Popular: SQL and NoSQL dominate the software industry.


Why RDBMS is Better

Advantages:

Data Integrity

  • Has a "schema" (like a blueprint) that enforces rules
  • Only allows valid data to be stored
  • Example: Age field won't accept text like "abc"

Data Abstraction

  • You don't need to know how data is physically stored
  • Just write simple queries to get what you need
  • Like driving a car without knowing how the engine works!

Better Scalability

  • Easier to grow and handle more data

No Redundancy or Inconsistency

  • Data is stored once and used everywhere
  • Updates happen everywhere automatically

Disadvantages:

Can Be Expensive

  • Needs more storage space because data is organized and formatted
  • Requires powerful servers

Scalability Challenges

  • If you design a table for 20 rows and suddenly need 1,000 rows
  • Performance can slow down significantly
  • Need to plan capacity carefully

The Three Levels of DBMS

Think of these as different floors in a building:

1. Physical Level (The Basement)

  • This is where actual data sits in computer memory (RAM, hard drive)
  • Deals with how bits and bytes are stored
  • Uses special techniques like Hashing and B+ Trees for efficiency

2. Logical Level (The Main Floor)

  • This is where you work with the database
  • Write queries and interact with data
  • Don't need to worry about physical storage
  • Like using an app without knowing the code behind it

3. View Level (The Penthouse)

  • What users actually see and interact with
  • Customized views for different users
  • Example: Students see grades, teachers see grades + edit options

What is a Schema?

A schema is like a blueprint or rulebook for your database. It strictly defines:

  • What tables exist
  • What columns are in each table
  • What type of data goes in each column (numbers, text, dates, etc.)
  • What the column names are
  • What rules must be followed (constraints)

Two Types of Schema:

Physical Schema

  • Describes how data is actually stored in memory
  • Uses efficient techniques like:
    • Hashing (quick lookups)
    • B+ Trees (organized searching)

Logical Schema

  • Defines the structure users interact with
  • Sets data type rules (age must be a number, email must have @, etc.)
  • Creates relationships between tables

Instance: A snapshot of what your database looks like at any moment in time.


DBMS Architecture Types

1-Tier Architecture (All-in-One)

  • Everything on a single computer
  • Simple but limited
  • Example: Microsoft Access on your laptop

2-Tier Architecture (Client-Server)

  • Your Computer (Client): Where you interact with the database
  • Server: Where the database actually lives
  • Example: Your banking app connecting to bank servers

3-Tier Architecture (Enterprise Level)

  • Presentation Layer: What you see (website, app interface)
  • Application Layer: Business logic and processing (server)
  • Database Layer: Where data is stored
  • Example: Amazon - you see the website, servers process orders, databases store everything

Top comments (0)