Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SELECT field,field with space FROM file.csv #32

Open
elvarb opened this issue Jan 11, 2019 · 1 comment
Open

SELECT field,field with space FROM file.csv #32

elvarb opened this issue Jan 11, 2019 · 1 comment
Labels

Comments

@elvarb
Copy link

elvarb commented Jan 11, 2019

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

@noborus
Copy link
Owner

noborus commented Jan 12, 2019

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 -'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants