It is sometimes handy save the output of an SQL query to a file.
\o option can be used to redirect the output of an SQL query to a file.
How to use
This will cause the output of subsequent SQL queries to be redirected to the file
The output of any query run after this command will be redirected to
\o is used again to set a different file, or until the
redirection is turned off by running
without specifying any filename.
This is useful when you want to save the results of a query for later analysis or to share with others. Or if you need to work with datasets that are too big to be shown on the terminal.