Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    SQLSQL

    First questions to the data

    • What are SQL and databases?
    • SELECT: choosing columns
    • WHERE: filtering rows
    • ORDER BY and LIMIT: sort and take the top

    Summarizing and grouping

    • Aggregates: COUNT, SUM, AVG
    • GROUP BY and HAVING
    • CASE, COALESCE and text functions

    Joining tables

    • Keys and relationships
    • INNER JOIN
    • LEFT JOIN: leave nobody out
    • Three-table joins and self joins
    • Subqueries and CTEs

    Building tables and changing data

    • CREATE TABLE and constraints
    • INSERT, UPDATE and DELETE
    • Transactions: all or nothing
    • SQL injection: the most dangerous mistake

    Professional level

    • Indexes: why is my query slow?
    • Window functions: rankings and totals without losing rows
    • Designing tables: normalization
    • Project: analytics for a learning platform
    SQL

    First questions to the data · Lesson 1 of 20

    What are SQL and databases?

    Tables, rows and columns, and your first query.

    7 minutes2 games

    Every app you use holds data: users, orders, messages. A database stores that data in an organized way, so you can search and change it quickly even with millions of rows.

    The most common kind is the relational database: data is split into tables. Each table has fixed columns, and each row is one thing: one student, one course.

    idnamecityxp

    1

    Laila

    Cairo

    320

    2

    Karim

    Alexandria

    150

    3

    Omar

    Cairo

    90

    …

    …

    …

    …

    The students table: each row is a student, each column a fact about them.

    SQL (said "sequel" or "S-Q-L") is the language you use to talk to a database. You say what you want and the database decides how to get it. That's a declarative style, unlike JavaScript and Python where you write the steps yourself.

    The first and most important command is SELECT: "give me". The star * means every column. Press Run:

    SQL
    SELECT * FROM students;

    The tables here are ready-made and every Run rebuilds the database from scratch. Try anything; even if you delete everything, nothing breaks.

    Important

    SQL keywords like SELECT and FROM are case-insensitive (select is the same), but by convention they're written in capitals so they stand out. Text goes in single quotes, 'Cairo', and a statement ends with ;.

    This SQL runs almost unchanged on PostgreSQL (which Supabase is built on), MySQL, and SQLite (which lives inside your phone and browser, and powers these lessons).

    Quick question

    In the students table, what does one row represent?

    Interview question

    What's the difference between a SQL (relational) database and a NoSQL database?

    Exercise

    There's another table called courses. Write a query that shows all of its columns and rows.

    Expected result:
    id | title | track | price | hours
    1 | HTML & CSS | web | 0 | 12
    2 | JavaScript | web | 450 | 30
    3 | Python | data | 400 | 28
    4 | SQL | data | 300 | 16
    5 | React | web | 600 | 24
    6 | C++ | systems | 500 | 36
    SQL
    -- Write your query here
    

    Learn more from

    • PostgreSQL docs: Conceptspostgresql.org
    • SQLite: SELECTsqlite.org
    • Wikipedia: Relational databaseen.wikipedia.org

    Played 0 of 2 games

    Sign in to save your progress and earn XP.

    NextSELECT: choosing columns
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.