In PostgreSQL, you can use the \connect meta-command of the client tool psql:
\connect DBNAME
or in short:
\c DBNAME
Note that it is not possible to switch the current database via an SQL command, like you asked.
MySQL's USE DatabaseName is named somewhat confusingly, because what MySQL calls a "database" is more similar to what other systems (like Oracle or PostgreSQL) call a "schema" (and PostgreSQL also lets you access multiple schemas from a single SQL session). To quote the official documentation:
Answer from Will Hartung on Stack OverflowUsers coming from an Oracle Database background may find that the MySQL meaning of a database is closer to what Oracle Database calls a schema.
postgresql - How to switch databases in psql? - Stack Overflow
postgresql - How do I merge database Oracle and Postgres into a Select? - Stack Overflow
How to select a oracle table from postgresql script? - Stack Overflow
Why is PostgreSQL becoming more popular than MySQL?
Q1: Can I switch between multiple databases without disconnecting my session?
Q3: What’s best way listing only application-specific (not template/system) databases quickly?
Q2: How do I confirm which exact database my terminal session points at now?
In PostgreSQL, you can use the \connect meta-command of the client tool psql:
\connect DBNAME
or in short:
\c DBNAME
Note that it is not possible to switch the current database via an SQL command, like you asked.
MySQL's USE DatabaseName is named somewhat confusingly, because what MySQL calls a "database" is more similar to what other systems (like Oracle or PostgreSQL) call a "schema" (and PostgreSQL also lets you access multiple schemas from a single SQL session). To quote the official documentation:
Users coming from an Oracle Database background may find that the MySQL meaning of a database is closer to what Oracle Database calls a schema.
You can connect to a database with \c <database> or \connect <database>.