PSQL Commands : This Shows The Table Structure Not The Contents
This document lists common psql commands for getting help on SQL syntax, listing databases and tables, connecting to databases, displaying table structure, quitting psql, executing queries and sending output to files, running commands from files, changing user passwords, and running Linux shell commands. The commands include \h for help, \l to list databases, \d to list tables, \c to connect to a database, \q to quit, \g to execute a query, and \! to run shell commands.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
44 views
PSQL Commands : This Shows The Table Structure Not The Contents
This document lists common psql commands for getting help on SQL syntax, listing databases and tables, connecting to databases, displaying table structure, quitting psql, executing queries and sending output to files, running commands from files, changing user passwords, and running Linux shell commands. The commands include \h for help, \l to list databases, \d to list tables, \c to connect to a database, \q to quit, \g to execute a query, and \! to run shell commands.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
psql commands
=============
● \h Help on SQL syntax
● \h commands Help on specific command's syntax. Space to move to next page. It works like the Linux ‘more’ command To quit help hit q ● \l List databases. (Lowercase L) ● \c Mydatabase Connect to the database called Mydatabase ● \d List the tables in the current database ● \d+ Mytable Display information about table Mytable. This shows the table structure not the contents ● \q Quit psql ● \g Execute query (same as ending query with ; ) ● \g FILENAME Execute query and send output to a file in the file system called FILENAME. This file will be created in the directory that you ran psql from ● \i FILENAME Execute commands from file in file system on your vm ● \password Securely change current user's password ● \! Shell command Allows you to run linux commands such as ls