When you use the Netezza nzsql command in interactive mode, there are many options that you can use. These options, known as Netezza nzsql internal slash options, are called with a backslash (\).
Many of the internal slash options are the same as those available on the command line. In this article, we will check some of commonly used Netezza nzsql Internal Slash Options.
Netezza nzsql Internal Slash Options
Following are some commonly used Netezza nzsql internal slash commands:
Command | Description |
\? | Lists the available internal slash commands. |
\h | Lists the available SQL commands. |
\h cmd | Displays help for a specific SQL command. For example: \h create table. |
\q | Quits nzsql. |
\c[onnect] [dbname] [username] [password] | Connect to new database. |
\l | Lists all databases. |
\dt | Lists all tables. |
\dSt | Lists all system tables. |
\d table | Describes a table. |
\dv | Lists all views. |
\dSv | Lists all system views. |
\d view | Describes a view. |
\echo text | Writes text to stdout. |
\! cmd | Shell escape or command. Runs a shell command without leaving the nzsqlsession. |
\f <sep> | Change field separator |
\i <file> | Read and execute queries from <file> |
\set <var> <value> | set internal variable |
\unset <var> | unset (delete) internal variable |
\e [file] | edit the current query buffer or [file] with external editor |
\w <file> | write current query buffer to a <file> |
\r | reset (clear) the query buffer |
\p | show the content of the current query buffer |
\o [file] | send all query results to [file], or |pipe |
Netezza nzsql Internal Slash command examples
Example to display all database names using Netezza internal slash command:
SYSTEM.ADMIN(ADMIN)=> \l List of databases DATABASE | OWNER -----------------+------- TEST| ADMIN SYSTEM | ADMIN (12 rows) SYSTEM.ADMIN(ADMIN)=>
Switch to different database within nzsql:
SYSTEM.ADMIN(ADMIN)=> \c TEST You are now connected to database TEST. TEST.ADMIN(ADMIN)=>
Also read:
- Netezza Basic Commands
- Commonly used basic Netezza Linux Commands
- nzload Command and its Usage in Netezza
- Run Netezza SQL Script File using nzsql Variable Substitution
- Netezza nzsql command and its Usage
- Netezza nzsql Query Buffer to Edit Command Line Queries