Sunday, 06 September 2026
Advertisement Advertise Your advert could be here Reach thousands of learners and ICT professionals across Rwanda. Contact us
Advertisement Opportunity Jobs, scholarships & hackathons Fresh openings from Rwandan job boards are pulled in every hour. See openings

What SQL is and how tables work

SQL & databases · lesson 1 of 8

In this lesson: Understand tables, keys and what SQL is for.

SQL (Structured Query Language) is how you talk to a relational database. You describe what you want; the database works out how to get it.

Tables

Data lives in tables — like a spreadsheet, but with strict rules. Here is a students table:

idnamecountrymark
1Aline UwaseRwanda91
2Eric NsengiRwanda64
3Grace AchiengKenya78
  • Each column holds one kind of value and has a fixed type.
  • Each row is one record — one student.

Common column types

INT            whole numbers
DECIMAL(10,2)  exact decimals — use this for money
VARCHAR(191)   text up to a length
TEXT           long text
DATE           2026-09-05
DATETIME       2026-09-05 14:30:00
BOOLEAN        true / false
Never store money in a FLOAT. Floating point cannot represent 0.10 exactly, so totals drift by a cent. Use DECIMAL, or store whole cents in an INT.

Primary keys

Every table should have a column that uniquely identifies each row — usually id. That is the primary key. It cannot be null and cannot repeat.

Foreign keys — how tables relate

A second table, enrolments, points at students by their id:

idstudent_idcourse
11Web development
21SQL
33Networking

student_id is a foreign key: it must match an id in students. This is what "relational" means, and it is what stops you ending up with an enrolment for a student who does not exist.

The four things you will do

SELECT   read rows
INSERT   add rows
UPDATE   change rows
DELETE   remove rows

Keywords are conventionally written in capitals. SQL does not care, but it makes queries far easier to read.

Create a free account to save progress

All lessons in this track

  1. 1
  2. 2
  3. 3
  4. 4
    INSERT, UPDATE and DELETE ~30 min account needed
  5. 5
    Aggregate functions ~25 min account needed
  6. 6
    GROUP BY and HAVING ~25 min account needed
  7. 7
    JOINs ~35 min account needed
  8. 8
    Creating tables and keys ~25 min account needed
Advertisement Yanjye Learn a new digital skill this week ICT, programming and professional courses with graded weekly assignments. Start free