AI Hints
Homeโ€บSQL Tutorialโ€บReading Error Messages
SQL ยท Lesson 104 of 126

Reading Error Messages

Fix mistakes fast.

โฑ 2 min readโ–ถ Video at 2:27:34๐ŸŽ“ Free
Watch this lesson in the SQL courseWatch on YouTube โ†—Full SQL course

Everyone writes broken queries. Beginners, experts, everyone. The difference is that experts read the error message, and fix it in seconds. Error messages look scary, but they're actually trying to help you. Let's break some queries on purpose, and learn to read what SQL tells us.

Reading Error Messages
From the video: Reading Error Messages
  • Everyone writes broken queries
  • Experts read the message
  • Errors are trying to help

No such column

Here's a typo. Prise, with an S. Run it. No such column, prise. And look, SQLite even points an arrow at the exact word. The fix is to check the spelling against the table.

query.sqlsql
SELECT title, prise
FROM books
LIMIT 3;
Output
Parse error near line 1: no such column: prise
  SELECT title, prise FROM books LIMIT 3;
                ^--- error here

No such table

Same idea, but with the table name. Book, instead of books. Run it. No such table, book. Table names have to match exactly.

query.sqlsql
SELECT title
FROM book;
Output
Parse error near line 1: no such table: book

Fixed

Fix the spelling, and it works. Run it. When you see no such column, or no such table, it's almost always a typo, or the wrong table.

query.sqlsql
SELECT title, price
FROM books
LIMIT 3;
Output
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚       title        โ”‚ price โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ The Silent Orchard โ”‚ 14.99 โ”‚
โ”‚ Code of the River  โ”‚ 12.99 โ”‚
โ”‚ Stars Over Lagos   โ”‚ 9.99  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary

No such column, and no such table, mean a name doesn't match. Check the spelling. Next, syntax errors.

Key takeaways
  • no such column
  • no such table
  • Check the spelling
Next up: Syntax Errors โ€” commas and quotes