SQL, delimiters for field names which have spaces
No, this isn’t rocket science. I had a table with a field name of “local authority” (no quotes) and wanted to do a SELECT. The space in the middle caused a moment of delay and head-scratching.
You can’t duck the issue because
SELECT local authority FROM tbl_nz_schools;
will cause a syntax error.
A rummage on Google got the answer from a MySql forum which seems worth repeating here: use the backwards quote as a delimiter. This is the obscure key which is typically to the left of the digit 1 on the keyboard.
SELECT `local authority` FROM tbl_nz_schools;