To list out all the existing databases in PostgreSQL:
1. Execute the SQL query from the system Catalog.
SELECT datname FROM pg_database;
2. The psql program's \l meta-command and -l command-line option are also useful for listing the existing databases.
- \l or \list - Lists all databases, their owners, and character encodings in the psql interface.
- \l+ or \list+ - Provides more detailed information, including database size and default tablespace.
- -l command-line option are also useful for listing the existing databases. (Ex: $ psql -l )
3. \c or \conninfo - displays the currently connected database.
Watch Video Format: https://youtube.com/shorts/2xTnrFbp_e0
** Connect with the author / trainer: https://suchitdba.blogspot.com/p/connect-with-author-database-trainer.html
** Email to info@shreyantech.com to get such Tip of the Day in your email
No comments:
Post a Comment