×

sql · level 2 · unit 7 · lesson 2

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

Dates in sort and compare in time order.

SQLite has no special date type. Dates are stored as text in ISO format: year, month, day, like '2026-04-15'. Because the biggest part comes first, A to Z order is also time order.

So <, > and ORDER BY work on dates as they are. keeps every date in April, both ends included.

pulls out the year and month, like '2026-04'. Group by it to count loans month by month.

SELECT strftime('%Y-%m', borrowed) AS month, COUNT(*) AS loans
FROM loans
GROUP BY month
ORDER BY month;

Always write two digits for the month and day, like '2026-04-05', or the order breaks.