Before this lesson
This is the starting point for this language; web development is not a prerequisite.
What you will be able to do
Create an isolated practice database, understand relational tables and select explicit columns.
Understand the mechanism
SQL describes the desired result rather than a row-by-row loop. Columns define structure and rows hold records. A primary key identifies a row, not its visual position.
CREATE TABLE defines structure, INSERT adds records and SELECT reads results. Separating an ID from a name preserves identity when the name changes. Every lesson starts from an empty database to keep results reproducible.
Results have no ordering guarantee without ORDER BY. Selecting id and name explicitly describes the required interface and avoids silently changing the result shape when columns are added.
Runnable example
This course uses SQLite 3. Open a fresh in-memory database, for example with sqlite3 :memory:, and run the complete script. Each lesson supplies its own schema and sample data, independent of the website database.
CREATE TABLE courses (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
minutes INTEGER NOT NULL
);
INSERT INTO courses(id, name, minutes) VALUES
(1, 'Python', 25), (2, 'Java', 40), (3, 'SQL', 20);
SELECT id, name FROM courses ORDER BY id;
Trace and verify
The result contains three rows and two columns: 1 Python, 2 Java and 3 SQL. minutes is stored but not selected.
Common mistakes and boundaries
SQLite typing differs from MySQL and PostgreSQL. Later lessons add constraints for business rules. Do not execute practice scripts in the website database.
Practice challenge
Select only name and minutes, ordered from shortest to longest duration.
Reference solution and reasoning
Use SELECT name, minutes FROM courses ORDER BY minutes ASC, id ASC;. The result is SQL20, Python25, Java40, with id as a tie-breaker.