What Is a Database and How Do Apps Use Them?
Learn what a database is, the difference between SQL and NoSQL, and how web apps use databases to store and retrieve data. A plain-language guide for beginner developers.
Every app that stores information uses a database. Your social media account, your order history, your saved preferences — all of that lives in a database somewhere. As a developer, understanding what databases are and how apps use them is fundamental.
What Is a Database?
A database is an organised collection of data that can be easily stored, retrieved, and updated. Think of it as a highly structured, queryable spreadsheet. Instead of a flat file, you get a system optimised for fast reads and writes at scale.
SQL Databases (Relational)
SQL databases store data in tables with rows and columns, like a spreadsheet. Tables relate to each other via keys. Examples: PostgreSQL, MySQL, SQLite.
-- A users table
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(255) UNIQUE,
created_at TIMESTAMP DEFAULT NOW()
);
-- Find a user by email
SELECT * FROM users WHERE email = 'kai@kaiko.dev';
SQL databases are great for structured data with clear relationships — e-commerce (orders relate to users relate to products), banking, and most traditional web apps.
NoSQL Databases
NoSQL databases store data in flexible formats — documents, key-value pairs, graphs. Examples: MongoDB (documents), Redis (key-value), Elasticsearch (search).
// A MongoDB document — no rigid schema required
{
"_id": "user_001",
"name": "Kaikobud",
"skills": ["Python", "Go", "Docker"],
"address": {
"city": "Dhaka",
"country": "Bangladesh"
}
}
NoSQL is great for flexible schemas, high write volume, and data that doesn’t fit neatly into tables.
How Apps Use Databases
The flow is always the same:
- User performs an action (submits a form, clicks a button)
- The server receives the request
- The server queries the database (read or write)
- The database returns a result
- The server sends a response to the user
The app never talks to the database directly from the browser — only the server does. This is important for security.
Conclusion
A database is where your app’s data lives. SQL databases for structured, relational data; NoSQL for flexibility and scale. As a backend developer, you’ll spend a lot of time writing queries, designing schemas, and thinking about how data flows through your application. Start with PostgreSQL — it’s excellent and free.
Read next: Connecting Python to PostgreSQL with psycopg2
External resource: PostgreSQL Official Documentation
Related Articles
CSS Flexbox in Plain English: A Beginner's Guide
Learn CSS Flexbox with simple, visual explanations. This guide covers display flex, justify-content, align-items, flex-wrap, and practical layouts every developer needs to know.
Docker for Backend Developers: A Practical Introduction
Learn how Docker works, why backend developers need it, and how to containerize your first Python or Go application in under 30 minutes.
Containerising a Backend Service: From Docker to Kubernetes
A practical walkthrough of containerising a Python backend service with Docker, deploying it to Kubernetes on ECS, and the production gaps that only show up once real traffic hits.