Read data from SQLite where column name contains spaces

Use single quotes

SELECT 'condition name' FROM library

or double quotes

SELECT "condition name" FROM library

in some cases the name of the table can contain space and even aphostrope, like:

SELECT condition's name FROM library

in this case replace ' with '' in the name of the table:

SELECT 'condition''s' name FROM library

And you put the table name outside the quote as in:

tableName."column name"

and not

"tableName.column name"


For quoting identifiers like table/column names, SQLite supports back ticks for compatibility with MySQL, and square brackets for compatibility with SQL Server, but the portable way is to use double quotes:

SELECT "condition name" FROM library

(Single quotes would be used for string values.)