How to Omit Column Headers for a SQL Statement
When executing SQL statements in batch mode using the mysql command-line tool, it may be desirable to exclude column headers for specific statements. To achieve this, utilize the -N option.
Using the -N Option:
Invoke mysql with the -N (alias for --skip-column-names) option:
mysql -N ...
For example:
mysql -N ... use testdb; select * from names;
Example Output (with Column Headers):
+------+-------+ | id | name | +------+-------+ | 1 | pete | 2 | john | 3 | mike +------+-------+
Example Output (without Column Headers):
1 pete 2 john 3 mike
Additional Options:
By utilizing these options, you can tailor the output of your SQL statements to suit your specific needs.
The above is the detailed content of How to Suppress Column Headers in SQL Statements with `mysql`?. For more information, please follow other related articles on the PHP Chinese website!