Skip to content

Select Star

You'll load a CSV into a real database and ask it questions in SQL, with no server, no command line and one free app.

About

SQL is the language every database speaks, and the entry fee is lower than you'd think. DB Browser for SQLite is free, runs on any laptop, and imports a CSV in one dialog, with no server and no command line. This badge is your first eight queries. The first thing that goes wrong is nearly always dates, which arrive as text, and you find out when a date range filter returns nothing. What counts is queries you typed, on data you loaded, with the results on screen. A tutorial's sample database doesn't count, and neither does a query you pasted from somewhere without being able to say what each clause does.

At a glance

Per requirement
15 XP
Completion bonus
75 XP
Requirements
6
Takes
One evening
Skill level
Novice (never tried it)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
On your own

Requirements

  1. 1
    Import a CSV of at least 500 rows into SQLite and look at the table. In DB Browser for SQLite, go to File, then Import, then Table from CSV, and check the box for the header row. Any export works: your bank, a fitness app, a city's open data portal, a sports season. Open the Browse Data tab and confirm the columns came in with the right types, because dates often arrive as text. Take a screenshot of the table with the row count visible. Photo
  2. 2
    Write a SELECT with WHERE and ORDER BY to find the top 10 of something. Something like SELECT * FROM trips WHERE distance > 5 ORDER BY distance DESC LIMIT 10 is the shape you want. Write it in the Execute SQL tab. Take a screenshot of the query and its results together. Photo
  3. 3
    Write a GROUP BY query with COUNT and SUM. Try SELECT category, COUNT(*), SUM(amount) FROM t GROUP BY category ORDER BY 3 DESC, which is a pivot table in one line. The trap is selecting a column you didn't group by, which gives you a quietly wrong answer with no error. Take a screenshot of the query and the results. Photo
  4. 4
    Filter on a date range and a text pattern. Something like WHERE date BETWEEN '2024-01-01' AND '2024-03-31' AND description LIKE '%coffee%' is the idea. If your dates came in as text in the wrong format, this is where you'll find out, so fix the format or import again. Take a screenshot of the query and the rows it returns. Photo
  5. 5
    Use a subquery or HAVING to answer a question a single WHERE can't. For categories with more than 20 rows, use GROUP BY category HAVING COUNT(*) > 20. For rows above the overall average, use WHERE amount > (SELECT AVG(amount) FROM t). Take a screenshot of one of each, or of one query that does both. Photo
  6. 6
    Save at least eight queries in a text file with a one-line comment above each. You've written five or six so far, so add two or three more questions you actually have about the file. Comments start with two hyphens. Say what question the query answers rather than what it does, so 'which weekday do I spend the most' beats 'group by weekday'. This file is the start of a habit the whole track leans on. Take a screenshot of the file. Photo