Skip to content

PostgreSQL

$ psql -p <port> -U <user> -d <DBName>
select ascii('w'), ascii('0'), ascii('0'), ascii('t');

select chr(119), chr(48), chr(48), chr(116);

select chr(119) || chr(48) || chr(48) || chr(116);
\?               # Show help for psql commands
\h               # Show SQL command help
\q               # Quit psql
\l               # List all databases
\c dbname        # Connect to another database
\dt              # List tables in current database
\d table_name    # Describe a table structure
\du              # List users and roles
\dn              # List schemas
\e               # Open editor to edit query
\i filename      # Execute SQL from file
\o filename      # Send query results to file
\conninfo        # Show current connection info
\timing          # Toggle query timing
\x               # Toggle expanded output