
Here's a preview from my zine, Become a SELECT Star!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
In some SQL implementations (like PostgreSQL), if you double quote a string it’ll interpret it as a column name:
smiling stick figure with short curly hair:
SELECT * FROM cats
WHERE name "ms piggy" ;
postgres:
error: column "ms piggy"
does not exist
person, thinking: right, I need to use single quotes
Here’s a table explaining what different quotes mean in different SQL databases. “Identifier” means a column name or table name.
Sometimes table names have special characters like spaces in them so it’s useful to be able to quote them.
single quotes (‘miss piggy’) | double quotes (“miss piggy”) | backticks (miss piggy ) |
|
---|---|---|---|
MySQL | string | string or identifier | identifier |
PostgreSQL | string | identifier | invalid |
SQLite | string | string or identifier | identifier |
SQL server | string | string or identifier | invalid |
person: I always use single quotes for strings in SQL queries! It keeps me (and others!) from getting confused.
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!