Free course · Lesson 1 of 5
Database Fundamentals & SQL Basics (MySQL & PostgreSQL)
In this lesson you will
- Explain tables, rows and columns
- Write basic SELECT and INSERT statements
A relational database stores data in tables (like spreadsheets) with rows (records) and columns (fields). SQL (Structured Query Language) is the universal language for interacting with databases. Popular database systems include MySQL (open-source, widely used in web apps) and PostgreSQL (advanced features, great for complex queries).
- A table has a fixed schema: each column has a name and a data type (
INT,VARCHAR,DATE). SELECT * FROM studentsretrieves all columns and rows from thestudentstable.- Use
WHEREto filter:SELECT * FROM students WHERE city = 'Juba'; - Always end SQL statements with a semicolon (
;) — the standard in both MySQL and PostgreSQL.
💡 Practical Skill: Install MySQL Workbench (GUI for MySQL) or
pgAdmin (GUI for PostgreSQL). Practice in the terminal with mysql> or psql>.
Both are free and run on Windows, macOS, and Linux.
SQL (MySQL / PostgreSQL)
-- Create a new databaseCREATE DATABASE rescue_academy; -- Use the databaseUSE rescue_academy; -- MySQL-- \c rescue_academy -- PostgreSQL alternative -- Create a students tableCREATE TABLE students ( id INT PRIMARY KEY AUTO_INCREMENT, -- SERIAL in PostgreSQL name VARCHAR(100) NOT NULL, age INT, city VARCHAR(50), program VARCHAR(100)); -- Insert sample dataINSERT INTO students (name, age, city, program)VALUES ('Grace', 22, 'Juba', 'Database Management'), ('John', 24, 'Malakal', 'Web Development'), ('Amina', 21, 'Wau', 'Data Science'); -- Query: show all studentsSELECT * FROM students;
Practice exercise
Create a table of five books in SQLite with title, author and year, then list the books published after 1990.
Key takeaways
- A database stores data in related tables
- SELECT reads data; INSERT, UPDATE and DELETE change it
- Always test the WHERE clause with a SELECT before an UPDATE or DELETE
Free self-study lesson — no certificate. For the full instructor-led program, see registration options.