diff --git a/README.md b/README.md index b5de684..07219af 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_356 TILs and counting..._ +_357 TILs and counting..._ --- @@ -175,6 +175,7 @@ _356 TILs and counting..._ - [Limit Execution Time Of Statements](postgres/limit-execution-time-of-statements.md) - [List All Columns Of A Specific Type](postgres/list-all-columns-of-a-specific-type.md) - [List All Rows In A Table](postgres/list-all-rows-in-a-table.md) +- [List All The Databases](postgres/list-all-the-databases.md) - [List All Versions Of A Function](postgres/list-all-versions-of-a-function.md) - [List Available Schemas](postgres/list-available-schemas.md) - [List Connections To A Database](postgres/list-connections-to-a-database.md) diff --git a/postgres/list-all-the-databases.md b/postgres/list-all-the-databases.md new file mode 100644 index 0000000..402d42c --- /dev/null +++ b/postgres/list-all-the-databases.md @@ -0,0 +1,15 @@ +# List All The Databases + +There are two ways to list all the available databases. The first is a +`psql` only command: + +``` +\list +``` + +The second approach is to query the `pg_database` table. Something like the +following will suffice: + +```sql +select datname from pg_database; +```