I am running some SQL queries from command line as follows:
cat my_query.sql | mysql --defaults-file=my_conf.cnf
I need to print column names whether the query returns any data or not. Currently when there is no data to return, i.e when query returns an empty result set this command does not print anything.
For example my query is:
-- id=-1 doesn't exist
SELECT col1, col2 FROM table WHERE id=-1
I need this query to return
col1 col2
Instead it returns nothing. Is it possible to do that using purely mysql and standard unix commands?
Thanks.
'[cmdlinedummy]'for strings.