What

Stores shit.

Relational Databases

They’re databases stores info in tables with existing relationships between them. They use SQL for querying and managing the data. They ensure data integrity through relationships, constraints and normalisation.

Example

1. Users Table
UserIDUsernameEmailDateCreated
1JohnDoejohn@example.com2023-01-15
2JaneSmithjane@example.com2023-02-20
3MikeJonesmike@example.com2023-03-10
2. Products Table
ProductIDProductNamePriceCategory
101Laptop800Electronics
102Headphones100Electronics
103Coffee Mug15Kitchen
3. Orders Table
OrderIDUserIDOrderDateTotalAmount
100112023-03-01815
100222023-03-05100
100312023-03-1215

Scaling Databases

Horizontal Scaling:

Take a database and, instead of beefing up a single database, you add more databases to help it.

  • Sharding: You split up the data into multiple different databases, and ensure the indexing matches.

  • Replication: Basically, just have multiple different databases with identical information.

Quick Accessing of Databses

  • Caching
  • Indexing
  • Query Optimisation