Using Sqlite to query a database I have a columns with spaces and special characters [duplicate]

Whilst trying to query a column which has spaces and commas, I tried using “Element,_Middle_or_High” using double quotes, and underscores, yet I am unable to get the result I want, but rather get:

sqlite3.OperationalError) near “or”: syntax error
[SQL: SELECT Elementary, Middle, or High School AVG(Safety_Score) as Average_Safety_Score FROM chicago_public_schools_data ORDER BY Average_Safety_Score;]

Tried double quotes and doesn’t work.

  • Tried double quotes and doesn’t work. Do not just say you tried, but please show how you tried. Double quotes are the way to go and should work if correctly used…

    – 

Thanks found a solution, by reading this link. This involved using backticks (MySQL) instead of using double quotes which work for PostgreSQL and Oracle

Leave a Comment