no such columnWhat is "no such column"?
SQLite stops with "no such column" when a query uses a column name the table does not have: a guess, a typo, a text value without quotes, or an alias used too early.
What SQLite is telling you
no such column: lengthThe query asked for a column called length, and none of the tables in it has one. Nothing runs. The four usual reasons:
- A guessed name. The column is
seconds, you guessedlengthorduration. - Text without quotes.
WHERE country = UKreadsUKas a column name. Text values need single quotes:'UK'. Double quotes,"UK", also mean a name in SQL, so stick to single quotes for text. - An alias used in WHERE.
SELECT seconds / 60 AS minutes ... WHERE minutes > 3fails, becauseWHEREruns beforeSELECThas named anything. - The wrong table. After a join,
a.titlefails iftitlelives in the other table.
How to find it
Read the name after the colon. Then check where it is used: if it is a value you meant to compare with, add quotes; if it is a real column name, look at the table's columns (the list above the editor, or PRAGMA table_info(songs);) and use the real spelling. If it is a name you made with AS, repeat the expression in WHERE instead.
Run it: a column that is not there
Press Run and read the error from the bottom up.
Tables artists, songs, listeners, plays
| id | name | country | genre |
|---|---|---|---|
| 1 | Nova Lane | UK | pop |
| 2 | The Tidewater | US | indie |
| 3 | Kaito Mori | JP | electronic |
| 4 | Amara Osei | GH | afrobeats |
| 5 | Lumen Choir | SE | pop |
| 6 | Rust & Velvet | UK | rock |
| 7 | Pixel Hearts | KR | pop |
| 8 | Juno Bay | AU | indie |
| id | title | artist_id | seconds | year |
|---|---|---|---|---|
| 1 | Neon Rain | 6 | 178 | 2022 |
| 2 | Slow Motion | 1 | 158 | 2025 |
| 3 | Paper Planes | 2 | 233 | 2023 |
| 4 | Static | 1 | 269 | 2020 |
| 5 | Golden Hour | 1 | 162 | 2022 |
| 6 | Night Bus | 7 | 157 | 2020 |
| 7 | Echoes | 2 | 281 | 2022 |
| 8 | Sugar Rush | 1 | 284 | 2019 |
| 9 | Low Tide | 4 | 289 | 2019 |
| 10 | Glass House | 7 | 152 | 2020 |
| 11 | Satellite | 1 | 282 | 2025 |
| 12 | Wildfire | 3 | 214 | 2022 |
First 12 of 30 rows. Query the table to see the rest.
| id | username | age | country |
|---|---|---|---|
| 1 | maya_k | 15 | UK |
| 2 | devraj | 17 | IN |
| 3 | lucia.p | 16 | ES |
| 4 | tom_h | 14 | UK |
| 5 | ana.s | 18 | BR |
| 6 | kenji | 16 | JP |
| 7 | zoe_r | 15 | US |
| 8 | femi | 17 | NG |
| 9 | liv | 13 | SE |
| 10 | oscar.b | 16 | NULL |
| id | listener_id | song_id | day | skipped |
|---|---|---|---|---|
| 1 | 10 | 16 | 2026-09-01 | 0 |
| 2 | 8 | 3 | 2026-09-01 | 0 |
| 3 | 5 | 16 | 2026-09-01 | 0 |
| 4 | 2 | 2 | 2026-09-01 | 0 |
| 5 | 5 | 21 | 2026-09-01 | 0 |
| 6 | 5 | 23 | 2026-09-02 | 0 |
| 7 | 6 | 1 | 2026-09-02 | 0 |
| 8 | 6 | 6 | 2026-09-02 | 0 |
| 9 | 8 | 2 | 2026-09-02 | 1 |
| 10 | 5 | 5 | 2026-09-02 | 0 |
| 11 | 7 | 13 | 2026-09-02 | 0 |
| 12 | 2 | 6 | 2026-09-03 | 0 |
First 12 of 70 rows. Query the table to see the rest.
SELECT title, length FROM songs ORDER BY length DESC;
Listeners from Spain go missing
This should list the username and age of every listener from Spain (ES). It stops with "no such column". Fix it.
SELECT username, age FROM listeners WHERE country = ES;