When you type nzsql -h, the system displays the command-line options that you can use. For a list and descriptions of the all the command-line options, see Table 1.
Normally output is well-formatted with white space added so that columns align. If you use the -A option, the nzsql command removes extra white space. Use this command when you want to compare results between two systems or when you want to transfer data.
#!/bin/bash
EXPORT CNT=‘nzsql -A -t -c "SELECT COUNT (*) FROM $1"‘
echo "The number of records in table $1 is $CNT"
nzsql -E
\l
********* QUERY *********
SELECT Database, Owner FROM _v_database
*************************
List of databases
database | owner
--------------+-------
database_one | admin
database_two | admin
system | admin
(3 rows)
The default delimiter between output columns is a pipe (|) symbol. When used with the -A option (unaligned output), you can specify a different delimiter string, such as a space, tab, comma, colon, or others. You can use the -R <string> to change the record separator. The default is newline.
You can format the nzsql output to use HTML tags.
Normally the nzsql command includes column headings and a summary row for all SQL queries. Use the -t option to eliminate the column headings and summary row. Use this option with the -A option to produce data in a transportable format.
You can use this option to display the query results vertically instead of in the default table/2D grid.