Skip to content

Instantly share code, notes, and snippets.

@yegorgavrilov
Created December 20, 2018 13:48
Show Gist options
  • Save yegorgavrilov/f79a3b99770ce229080d0cd26b42ae12 to your computer and use it in GitHub Desktop.
Save yegorgavrilov/f79a3b99770ce229080d0cd26b42ae12 to your computer and use it in GitHub Desktop.
IBM Netezza SQL basic commands
\a toggle between unaligned and aligned mode
\act show current active sessions
\c[onnect] [dbname [user] [password]]connect to new database (currently 'RJEYARAJ_DB')
\C <title> HTML table title
\copy ... perform SQL COPY with data stream to the client machine
\d <table> describe table (or view, index, sequence, synonym)
\d{t|v|i|s|e|x} list tables/views/indices/sequences/temp tables/external tables
\d{m|y} list materialized views/synonyms
\dS{t|v|i|s} list system tables/views/indexes/sequences
\dM{t|v|i|s} list system management tables/views/indexes/sequences
\dp <name> list user permissions
\dpu <name> list permissions granted to a user
\dpg <name> list permissions granted to a group
\dgp <name> list grant permissions for a user
\dgpu <name> list grant permissions granted to a user
\dgpg <name> list grant permissions granted to a group
\d{u|U} list users/User Groups
\d{g|G|Gr} list groups/Group Users/Resource Group Users
\da[+] [name] list aggregates, + for additional fields
\dd [object] list comment for object
\df[+] [name] list functions, + for additional fields
\dl[+] [name] list libraries, + for additional fields
\do list operators
\dT list data types
\e [file] edit the current query buffer or [file] with external editor
\echo <text> write text to stdout
\f <sep> change field separator
\g [file] send query to backend (and results in [file] or |pipe)
\h [cmd] help on syntax of sql commands, * for all commands
\H toggle HTML mode (currently off)
\i <file> read and execute queries from <file>
\l list all databases
\o [file] send all query results to [file], or |pipe
\p show the content of the current query buffer
\pset <opt> set table output <opt> = {format|border|expanded|fieldsep|null|recordsep|tuples_only|title|tableattr|pager}
\q quit nzsql
\qecho <text> write text to query output stream (see
\o)
\r reset (clear) the query buffer
\s [file] print history or save it in [file]
\set <var> <value> set internal variable
\t show only rows (currently off)
\time print time taken by queries
\T <tags> HTML table tags
\unset <var> unset (delete) internal variable
\w <file> write current query buffer to a <file>
\x toggle expanded output (currently off)
\! [cmd] shell escape or command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment