Introduction to relational databases, CRUD operations, schema design, SQL querying, and choosing between SQL and NoSQL with hands-on MySQL examples
Have you ever wondered how banks keep track of millions of transactions, how your favorite streaming service remembers what you watched, or how online shops instantly find the perfect product for you?It’s not magic — it’s databases.Databases power everything from hospital records to social media feeds. In this lesson we’ll explain what a database truly is, why merely storing data isn’t enough, and how structured data helps you answer questions, make decisions, and build smarter systems.Hi, I’m Alan, and I’ll be your guide. Together we’ll explore the essential concepts behind data storage and retrieval so you can design and query databases with confidence.
What we’ll cover first
What a database is (beyond files and spreadsheets).
How structure — tables, columns, and types — enables fast, reliable queries.
Why relationships between data matter.
Next, we’ll look at how databases are organized and when a spreadsheet stops being enough. Relational databases introduce tables and the structural champions of data integrity: primary keys and foreign keys. You’ll learn how to read an Entity Relationship Diagram (ERD) so you can visualize how data connects behind the scenes.Core skills you’ll gain
Reading ERDs to map real-world entities to tables.
CRUD is the set of core operations you’ll use in almost every database workflow. Think of it as the four basic verbs for working with data: Create new records, Read or query them, Update values, and Delete when appropriate.
Then comes the heart of working with data: CRUD operations. CRUD stands for Create, Read, Update, and Delete — the four essential actions you’ll perform in most databases.
Hands-on with MySQL
You’ll get practical experience building your first relational database in MySQL and writing basic SQL queries. Below is a typical interactive session showing two simple tables and their contents:
mysql> SELECT * FROM users;+---------+----------+--------------------+| user_id | username | email |+---------+----------+--------------------+| 1 | fluffy | fluffy@email.com || 2 | paws | paws@email.com |+---------+----------+--------------------+2 rows in set (0.00 sec)mysql> SELECT * FROM videos;+----------+---------+-------------------+---------------------------+-------------+| video_id | user_id | title | link | upload_date |+----------+---------+-------------------+---------------------------+-------------+| 1 | 1 | Cat Skateboard | www.miaowtube/watch1 | 2025-05-25 || 2 | 2 | Epic Cat Jump | www.miaowtube/watch2 | 2025-05-27 || 3 | 1 | Cat vs Curtain | www.miaowtube/watch3 | 2025-05-29 |+----------+---------+-------------------+---------------------------+-------------+3 rows in set (0.00 sec)
Relational vs. non-relational (NoSQL)
Not all databases look or behave the same. Choosing between SQL (relational) and NoSQL (non-relational) depends on your data shape, consistency needs, and scaling goals. The table below summarizes common trade-offs:
Flexible schemas, horizontal scale, high write throughput
MongoDB, Cassandra, DynamoDB
Common misperceptions
NoSQL is not inherently “better” — it’s optimized for different use cases.
Relational databases can scale well with appropriate architecture and indexing.
Finding and filtering data: key SQL clauses
You’ll learn to find data efficiently using SELECT, WHERE, ORDER BY, LIMIT, and JOIN. Indexes are the secret behind fast searches — but they add write overhead and extra storage, so use them thoughtfully.
Indexes speed up reads but can slow writes and require additional storage. Create indexes for frequently searched columns and measure their impact with real workloads.
Example: find the 3 most recent videos uploaded after a date
SELECT *FROM videosWHERE upload_date > '2025-06-01'ORDER BY upload_date DESCLIMIT 3;
Quick reference: common SQL clauses
Clause
Purpose
Example
SELECT
Choose columns
SELECT title, upload_date FROM videos
WHERE
Filter rows
WHERE upload_date > '2025-06-01'
ORDER BY
Sort results
ORDER BY upload_date DESC
LIMIT
Restrict row count
LIMIT 10
JOIN
Combine tables
JOIN users ON videos.user_id = users.user_id
Schema design: an example
At the end of the course you’ll design a relational schema and practice CRUD across connected tables. Here’s a basic example of creating a customers table in SQL:
CREATE TABLE customers ( customer_id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
You’re not alone — at KodeKloud you’ll join a global community where you can ask questions and share progress.If you’ve ever wanted to turn messy data into powerful insights or simply understand the technology shaping our digital world, get ready to dive in.