# Resouces
## Database
+ Intro to Databases – W3Schools
https://www.w3schools.com/sql/sql_intro.asp
+ Database Basics – Khan Academy
https://www.khanacademy.org/computing/computer-programming/sql
## Mariadb?
+ What is MariaDB? – MariaDB Official Docs
https://mariadb.com/kb/en/what-is-mariadb/
+ MariaDB vs MySQL – DigitalOcean
https://www.digitalocean.com/community/tutorials/mariadb-vs-mysql
+ MariaDB vs Other DBMS – Hostinger
https://www.hostinger.com/tutorials/mariadb-vs-mysql)
+ Types of Databases – IBM Docs
https://www.ibm.com/cloud/learn/database-types
+ SQLFiddle (MariaDB)
https://sqlfiddle.com/
+ DB-Fiddle – MariaDB Playground
https://www.db-fiddle.com/
## Dockerfile + Databases
+ Docker MariaDB Guide – Docker Docs
https://hub.docker.com/_/mariadb
+ Docker + Databases – DigitalOcean
https://www.digitalocean.com/community/tutorial_series/docker
---
# 📘 1. What Is a Database?
## 🔹 **Definition**:
A **database** is an organized collection of data that allows for efficient storage, retrieval, and manipulation of information. Think of it like a digital filing cabinet.
## 🔹 **Types of Databases**:
* **Relational Databases** (e.g., MariaDB, MySQL, PostgreSQL)
* **NoSQL Databases** (e.g., MongoDB, Redis)
## 🔹 **Key Concepts**:
* **Tables**: Data is stored in rows and columns.
* **Rows**: Individual records (like a student in a class).
* **Columns**: Data attributes (name, age, email, etc.)
* **SQL**: Structured Query Language, used to interact with databases.
---
# 🐬 2. What Is MariaDB?
## 🔹 **Definition**:
**MariaDB** is a **relational database management system (RDBMS)**. It’s a **drop-in replacement for MySQL**, created by the original MySQL developers after Oracle acquired MySQL.
## 🔹 **Is MariaDB a type of database?**
Not exactly — it's a **software system used to manage a database**. The **data model** it uses is relational (SQL-based).
---
# 🧠 3. What Does MariaDB Do?
## 🔹 It helps you:
* Create databases
* Store and retrieve data using **SQL queries**
* Secure and manage user access
* Handle large-scale, structured data efficiently
## 🔹 Difference from other DBMS:
| Feature | MariaDB | MySQL | PostgreSQL | MongoDB |
| -------------- | ----------- | ------------------- | ---------- | -------------------- |
| Type | Relational | Relational | Relational | NoSQL (Document) |
| SQL support | Yes | Yes | Yes | Limited |
| Performance | High | High | Moderate | Very High (scalable) |
| ACID-compliant | Yes | Yes | Yes | Optional |
| Open-source | Yes (GPLv2) | Yes (some versions) | Yes | Yes |
---
# 🛠️ 4. Common Practice Usage
## 🧪 Example: Creating a Blog Database
```sql
CREATE DATABASE blog;
USE blog;
CREATE TABLE posts (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255),
content TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO posts (title, content) VALUES ('My First Post', 'Hello, world!');
SELECT * FROM posts;
```
## 🔹 Common Use Cases:
* Web apps (e.g., WordPress, Laravel)
* E-commerce systems
* Inventory/CRM systems
* IoT data storage
---
# 📦 5. Visual Diagram: MariaDB in Docker
Here is a conceptual diagram to help you **visually understand** the structure.
```
[Your Machine / Server]
|
┌──────────────┐
| Docker Engine|
└────┬─────────┘
|
┌──────┴────────────┐
| MariaDB Image | ← Downloaded from registry (e.g., DockerHub)
└──────┬────────────┘
|
┌──────┴────────────────────┐
| MariaDB Container |
| ┌──────────────────────┐ |
| | OS (Debian base) | |
| | └── mariadb-server | |
| | └─ SQL Engine | |
| └──────────────────────┘ |
| ┌──────────────────────┐ |
| | Data Volume (Persist)| |
| └──────────────────────┘ |
└───────────────────────────┘
```
* **Image**: A read-only template (base OS + MariaDB)
* **Container**: Running instance of the image
* **Volume**: Stores your actual database files so you don't lose data when the container stops