Use Database Command in PostgreSQL

Hello!

Today we are going to talk about what is equivalent of use database command in PostgreSQL.

Use database_name command mostly, refers to changing database connection in most of the database engines. For instance you are working on HR database and need to change your connection to MRP database to update some settings on MRP database. In that situationg you can run a use database_name statement. PostgreSQL provides a different option for use database command in PostgreSQL

TL;DR \c database_name

Use Database_name Command

Switching beetwen databases usually requires a disconnect and connect. Some database engines provides this feature with use command. In PostgreSQL’s psql, this feature is provided with \c command.

Connect Command in PostgreSQL

Connect command is (\c and \connect commands are aliases) command used to connect databases.

In this page, you can find documentation of \c and \connect commands.

Keep in touch

If you find our articles helpful, please leave a comment below. Have a question? Please do not hesitate to leave a comment below. I would like to hear from you, and try my best to get in touch with you as soon as possible.

A new post everyday, subscribe now and don’t miss it!

Subscribe to our newsletter for cool news

Hi! I’m an IT Specialist

I want to hear from you! I am Working with enterprises for 10+ years to improve their infrastructure and efficiency.

Get in touch with me.

Leave a Reply

Discover more from Empower. Innovate. Transform.

Subscribe now to keep reading and get access to the full archive.

Continue reading