+3 votes
in Databases by (71.8k points)
edited by

In MySQL, we use show databases to check the list of databases. What is the equivalent command in postgresql?

1 Answer

+1 vote
by (71.8k points)
selected by
 
Best answer

Once you are on postgres=#  prompt, you need to type the following commands to see the list of databases and tables.

  • \list or \l: to list all databases
  • \dt or \d : to list all tables in the current database

 To connect to a particular database: \connect database_name (e.g. \connect myproject). Once you are connected to a particular database, \dt or \d to list all tables in the current database.


...