MySQL · Beginner

MySQL Fundamentals

Learn to design tables and write SQL to store, retrieve, and relate data: the backbone of every dynamic website.

Units
4
Lessons
20
Practice questions
61
Minutes
~300

Start learning today

Try every course free for 7 days. After that, this course is in Learnix Pro (KES 699/month).

Create free account Log in

What you'll learn

Understand tables, rows and columns

Write CREATE TABLE statements with sensible data types

Insert, select, update and delete data with SQL

Filter and sort results with WHERE and ORDER BY

Join related tables together

Summarize data with aggregate functions and GROUP BY

How the lessons work

Clear explanations

Step-by-step lessons in plain language

52 in this course

Worked examples

Real code and examples you can copy and run

59 in this course

Quick checks

Test your understanding as you go

38 in this course

Fill the blank

Recall the key commands and syntax

20 in this course

Hands-on workspace

A practical task at the end of every lesson

20 in this course

Syllabus

  1. 1.1

    Databases, Tables, and SQL

    A database is just a very organized set of spreadsheets, and SQL is the language you use to ask it questions and give it instructions.

  2. 1.2

    Creating Tables & Choosing Data Types

    Before a table can hold any data, CREATE TABLE has to define its columns up front, including what TYPE of value each column is allowed to hold.

  3. 1.3

    Inserting & Querying Data

    INSERT is how you add new rows to a table, and SELECT is how you read them back, with WHERE to narrow down which rows you want, and ORDER BY to put them in a sensible order.

  4. 1.4

    Filtering & Sorting: WHERE, LIKE, IN, BETWEEN, NULL

    Ask precise questions of your data: combine conditions, search text with patterns, match lists and ranges, handle missing values, and sort and page the results.

  5. 1.5

    Updating & Deleting Data

    UPDATE changes existing rows and DELETE removes them entirely, both are permanent the instant they run, and both are genuinely dangerous without a WHERE clause.

  1. 2.1

    Relating Tables with JOIN

    Real-world data almost never fits in one giant table: JOIN is how you pull matching rows from two separate, related tables back together into a single result.

  2. 2.2

    JOIN Types in Depth: INNER, LEFT, and RIGHT

    The earlier JOIN lesson showed matching rows from two tables, but what happens to rows that DON'T have a match on the other side depends entirely on which type of JOIN you choose.

  3. 2.3

    Aggregate Functions & GROUP BY

    COUNT, SUM, AVG and friends squash many rows down into a single summary number: GROUP BY simply runs that same summary separately for each distinct category instead of for the whole table at once.

  4. 2.4

    Business Reports with GROUP BY & HAVING

    Turn raw orders into the reports managers ask for: sales per customer, per category, per month, and only the groups that matter.

  5. 2.5

    SQL Functions & CASE: Transforming Values

    Clean and reshape data inside the query: text functions, number rounding, dates, and CASE for if/else logic.

  1. 3.1

    Subqueries & Common Table Expressions

    Use the result of one query inside another: compare to an average, find rows with no match, and write readable step-by-step queries with WITH.

  2. 3.2

    Window Functions: Rankings & Running Totals

    Rank rows, number them within groups and calculate running totals, without collapsing rows like GROUP BY does.

  3. 3.3

    Views: Saving a Query as a Virtual Table

    A VIEW lets you save a complicated SELECT under a simple name and query it as though it were an ordinary table: the query itself only has to be written once, correctly, and then reused everywhere.

  4. 3.4

    Indexes and Why They Matter

    An index lets MySQL find rows without scanning the entire table one row at a time: the same trick as a book's index letting you jump straight to a page instead of reading it cover to cover.

  5. 3.5

    Transactions: COMMIT and ROLLBACK

    A transaction groups several SQL statements into one all-or-nothing unit: either every single one of them succeeds together, or none of them take effect at all, which matters enormously the moment money or related records are involved.

  1. 4.1

    Database Normalization Basics: 1NF, 2NF, 3NF

    Normalization is a set of practical guidelines for splitting data into well-organized tables so nothing gets duplicated and nothing gets stuck in an inconsistent state: 1NF, 2NF and 3NF are just three checkpoints along that path, each building on the one before.

  2. 4.2

    Constraints & Foreign Keys: Let the Database Protect Your Data

    Make bad data impossible with NOT NULL, UNIQUE, CHECK, DEFAULT and foreign keys with ON DELETE rules.

  3. 4.3

    Changing Tables Safely: ALTER TABLE & Migrations

    Add, rename and change columns on a live database without losing data, and keep every change in versioned migration files.

  4. 4.4

    Users, Permissions & Backups

    Give each app only the access it needs, and make sure you can restore your data when (not if) something goes wrong.

  5. 4.5

    Project: A School Fees Database

    Design and query a complete database for school fees: students, fee structures and M-Pesa payments, with the reports a bursar actually needs.

Earn a verifiable certificate

Finish every lesson and pass the 20-question final exam (70% to pass). Each certificate has a unique number anyone can check online.

Get started

Helping with:

🍪 We use essential cookies to keep you signed in, protect your account and remember your settings. We don't use advertising or tracking cookies. Read our Privacy Policy.