Introduction to Database Design

Select a topic below to jump directly into foundations, SQL, installation, or data models.

Scroll or tap a topic to jump to its card.

Data: The Building Blocks of Modern Apps

Welcome to the world of Data

In this lesson, we'll explore the information that powers your favorite apps and sites — what data is, how it's shaped, and how databases keep it all organized.

Key Topics

Understanding Data: What's the Big Deal?

Data is the secret sauce of modern applications — the raw facts your app collects and processes. When data is organized and interpreted, it becomes information you can act on.

Types of Data: A Colorful Variety

Different problems call for different data shapes. Here are the three common types:

Basic Databases Concept: Where the Magic Happens

A database is a collection of related data organized so it can be easily accessed, managed, and updated. Think of it as a super‑organized fridge — everything has a spot, and you can find items fast.

Core Building Blocks
Quick Example
Users(id, name, email)
Orders(id, user_id, total_amount)

• Primary Key: Users.id, Orders.id
• Foreign Key: Orders.user_id → Users.id

You're ready to dive into the world of data with confidence. Understanding data is the key to unlocking modern apps. Go forth and explore!

← Back to Database Home

Types of Data Models: Meet the Data Family

Data models describe how we organize and connect data in a system.

  1. Hierarchical Model — tree‑like structure with one parent per child.
    Use case: organizational charts, file directories.
  2. Network Model — more flexible than hierarchical; each item can have multiple connections.
    Use case: telecommunications and complex networks.
  3. Relational Model — stores data in tables that can be linked by relationships.
    Use case: most business applications (e.g., customer management systems).
  4. Object‑Oriented Model — stores data as objects, useful for complex structures.
    Use case: video games and simulations.

Databases: The Digital Filing Cabinets of the Web

Now that we've covered data, let's see how websites keep it organized and accessible — like magic, but with more zeros and ones!

Key Topics: Your Database Adventure Map
More Resources

Install MySQL and Workbench (Windows)

Before writing SQL, set up MySQL Server and MySQL Workbench on your Windows PC.

Step 1: Download MySQL Installer

Step 2: Install and Configure MySQL

Step 3: Using MySQL Workbench

Quick Health Check
-- Check server version
SELECT VERSION();

-- Create and view a test database
CREATE DATABASE IF NOT EXISTS SetupCheck;
SHOW DATABASES;

If you can run these without errors, your setup is good to go. Next up: writing SQL!

SQL: The Universal Database Language

SQL is like a cool translator between your app and the database. It helps your application:

And there you have it! You're on your way to rocking the database world. Remember: databases are the unsung heroes keeping our favorite websites and apps running smoothly. Next time you're scrolling through your feed, give a nod to the hardworking databases behind the scenes.

Building Your First Data Table: Let's Get Hands-On!

Welcome, data architects! Now that you've learned the basics, let's roll up our sleeves and build the foundation for your project.

Lesson Objectives: Your Data Adventure Checklist
Designing Your Data Table: Let's Build!

Imagine a magical filing cabinet for your project. Each drawer is a table, each folder a row, and each sheet of paper a field value.

  1. Conceptualize your needs
    What information do I want to track? What details will be useful later? Any features I might add in the future?
  2. Identify essential data points
    Amount/Value, Date/Time, Category, Description
  3. Assign appropriate data types
    Amount → number (INT/DECIMAL), Date/Time → DATE/TIMESTAMP, Category → TEXT/VARCHAR, Description → TEXT (with sensible limit)

Creating Your First Database (SQL)

Open your SQL editor (e.g., MySQL, PostgreSQL, SQL Server) and run these commands:

-- Create a database
CREATE DATABASE SampleDB;

-- Switch to it (MySQL)
USE SampleDB;

-- Create a simple table
CREATE TABLE Products (
  id INT PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  price DECIMAL(10,2) NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Insert a couple of rows
INSERT INTO Products (id, name, price) VALUES
  (1, 'Notebook', 5.50),
  (2, 'Pencil', 1.25);

-- Query data
SELECT * FROM Products ORDER BY price DESC;

Challenges 🧪

  1. Creating a Sales Database 🛒
    -- Create SalesDB
    CREATE DATABASE SalesDB;
    
    Tip: After creating it, switch to it (e.g., USE SalesDB;) and try creating a Sales table with columns like id, amount (DECIMAL), category (VARCHAR), and sold_at (TIMESTAMP).
  2. Creating and Dropping a School Database 🏫
    -- Create SchoolDB
    CREATE DATABASE SchoolDB;
    
    -- If it was just a test, drop it
    DROP DATABASE SchoolDB;
    
    Tip: In a real project, you'd add tables (e.g., Students, Courses) before dropping a test database.
More Resources

← Back to Database Home