trdsql icon indicating copy to clipboard operation
trdsql copied to clipboard

SELECT field,field with space FROM file.csv

Open elvarb opened this issue 7 years ago • 1 comments

It is impossible to select a field name that contains a space.

elvarb avatar Jan 11 '19 12:01 elvarb

If the field name contains spaces, it must be enclosed in quotation marks. Quotation marks depend on the database driver.

SQLite 3 is double quotes (") and backquotes (`).

echo "i d,n a m e\n1,Alice"| trdsql -driver sqlite3 'SELECT "i d", "n a m e" FROM -'

and

echo "i d,n a m e\n1,Alice"| trdsql -driver sqlite3  'SELECT `i d`, `n a m e` FROM -'

postgres is a double quotation mark (").

echo "i d,n a m e\n1,Alice"| trdsql -driver postgres  'SELECT "i d", "n a m e" FROM -'

mysql is a backquotes (`).

echo "i d,n a m e\n1,Alice"| trdsql -driver sqlite3  'SELECT `i d`, `n a m e` FROM -'

noborus avatar Jan 12 '19 00:01 noborus