postgresql

PostgreSQL is a powerful, open-source relational database management system (RDBMS) that is known for its extensibility and standards compliance. It is often used as a backend database for web applications and supports a variety of data types, indexing, and advanced features like transactions and foreign keys.

Connecting
psql -h hostname -d database -U username 

# To list all the users
\du
\du+
\deu+

# To list a username if present
\du username

# To list all databases
\list
\l
\l+

# Connect to a database
\connect database_name

# List all the tables in the current database
\dt
\dt+

# Describe a table
\d+ table_name


# Execute Query
SELECT * FROM <table>;

# Quit
\q

Managing postgresql service

sudo service postgresql stop
sudo service postgresql start
sudo service postgresql restart