Lesson 7 of 7
Project: your database
This time the database is empty: you create the schema, insert the data and produce a report from it — the full cycle of a real database.
CREATE TABLE defines the schema, INSERT fills it, and your GROUP BY query produces the final report.
CREATE TABLE tracks (id INTEGER PRIMARY KEY, title TEXT, artist TEXT, plays INTEGER);
INSERT INTO tracks (title, artist, plays) VALUES ('Neon', 'Volt', 120);🎯 Exercise
1) Create the tracks table (id INTEGER PRIMARY KEY, title TEXT, artist TEXT, plays INTEGER). 2) Insert the 4 tracks: Neon/Volt/120, Pulse/Volt/340, Echo/Mira/210, Drift/Mira/90. 3) Write the query returning, per artist, the sum of plays, sorted by descending sum.
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →