> For the complete documentation index, see [llms.txt](https://dailyjournal.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dailyjournal.gitbook.io/notes/databases/database.md).

# Introduction

* Data is a collection of facts such as numbers, descriptions, and observations used to record information.
  * Structured data - ***tabular*** schema
  * Semi-structured data - ***JSON***
  * Unstructured data - documents, images, audio and video, and binary files.

{% embed url="<https://www.scylladb.com/wp-content/uploads/differences-between-sql-databases-and-nosql-databases.png>" %}

## Relational Databases a.k.a. SQL Databases

* designed in the 1970s
* a table-based relation data structure that defines and manipulated data using pre-defined schemas to determine its structure.
* used to store and query structured data.
* follows [**ACID**](https://dailyjournal.gitbook.io/notes/databases/database/database-transaction-models#acid-model) property which makes it capable of performing different tasks as a single logical operation.
* Examples - MySQL, Microsoft SQL Server, MariaDB, Oracle

{% hint style="danger" %}

* not suitable for frequently changing data
* not flexible due to its rigid pre-determined structure
* difficult to scale as the data increases so the app size increases as well
* are horizontally scalable making them more expensive than non-relational databases
  {% endhint %}

## Non-Relational Databases a.k.a. NoSQL Databases

### Key-Value databases

* Example - Redis

### Document databases

* Examples - MongoDB, Couchbase

### Column Family databases

### Graph databases

* Example - Neo4j

{% hint style="success" %}

* can handle the storage of structured and semi-structured data due to its non-tabular form.
* are horizontally scalable making them cheaper than relational databases.
* can make multiple databases with different structures and syntax.
  {% endhint %}

{% embed url="<https://database.guide/>" %}

{% embed url="<https://db-engines.com/en/ranking>" %}

{% embed url="<https://www.interviewbit.com/dbms-interview-questions/>" %}
