Intro to Databases and types

Intro to Databases

Role of Databases in Web Applications

Evolution of Databases

Database Management Systems (DBMS)

Ways to Interact with DBMS

Common Uses

Key Features of DBMS

Feature Description
Concurrency Manages multiple simultaneous users without data corruption or loss
Consistency Maintains valid and consistent data under concurrent operations
Security Controls access via user authentication and permissions
Reliability Supports data backups and rollback in case of failures
SQL Support Uses SQL with intuitive syntax for data operations

SQL (Structured Query Language)

Architecture: Two-Tier and Three-Tier

Pasted image 20260113142309.png

Two-Tier Architecture

Three-Tier Architecture

  1. Tier I (Client): GUI/Web interfaces for user interaction (e.g., login, commenting)
  2. Tier II (Application Server):
    • Middleware that translates requests into DB-friendly queries
    • Uses DBMS-specific libraries/drivers
  3. Tier III (DBMS):
    • Executes queries: insert, retrieve, delete, update
    • Returns data or error codes

Hosting Considerations


Types of Databases

Two Types of Databases

Databases are generally divided into:

Relational Databases

Example

Schema Relationships

Example Table Structure:

Pasted image 20260113143641.png|500

Common RDBMS Examples:


Non-Relational Databases (NoSQL)

Common Storage Models:

  1. Key-Value
  2. Document-Based
  3. Wide-Column
  4. Graph-Based

Table of posts with entries: id 100001, date 01-01-2021, content 'Welcome to this web application'; id 100002, date 02-01-2021, content 'This is the first post on this web app'; id 100003, date 02-01-2021, content 'Reminder: Tomorrow is the...'. Keys and values are indicated|500

Key-Value Store Example (JSON):

{
  "100001": {
    "date": "01-01-2021",
    "content": "Welcome to this web application."
  },
  "100002": {
    "date": "02-01-2021",
    "content": "This is the first post on this web app."
  },
  "100003": {
    "date": "02-01-2021",
    "content": "Reminder: Tomorrow is the ..."
  }
}

Common NoSQL Example:


Injections