0
$\begingroup$

I am taking the Coursera assignments on SQL and came across to a question where one of the tables has a column with this name:

Elementary, Middle, or High School

I do not know how to deal with this column. However, I saw this answer on the web recommending to refer to it as this:

(Elementary||', '||Middle||', or '||High School)  Elementary, Middle, or High School

but I got this error:

sqlite:///FinalDB.db
(sqlite3.OperationalError) near "School": syntax error
[SQL: select (Elementary||', '||Middle||', or '||High School)  Elementary, Middle, or High School, avg(safety_score) from schools groupby (Elementary||', '||Middle||', or '||High School)  Elementary, Middle, or High School]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
$\endgroup$
3
  • $\begingroup$ This fits stackoverflow better, I think. $\endgroup$ Mar 31 at 11:21
  • $\begingroup$ I think this is caused by the fact that the 'High School' column has a space in its name, you can use double quotes to use the column, i.e. "High School". $\endgroup$
    – Oxbowerce
    Mar 31 at 13:45
  • $\begingroup$ @Oxbowerce Ok, let me check it to see if it works. $\endgroup$
    – Baghban
    Mar 31 at 14:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.