Psql show tables8/25/2023 We can also make use of the alternative PostgreSQL query on the table pg_tables, which is located inside the pg_catalog database that stores the details of all the tables that include all the user-defined tables and the system tables present in the PostgreSQL database. Using the pg_tables to Get the List of Tables We can observe that besides the name of the table, its owner, and schema type, we can get the size of the table and the additional description if set against the table. To get the additional details about the retrieved tables, we can use the same meta-command and append the + plus operator to it, as shown below. We can observe that two tables, namely demo and educba_demo, are present in the Postgres database and are public. Now, to show all the tables stored inside the educba database, we can use meta-command \dt. ![]() We will use the metacommand \c as shown below to connect to the educba database. We can use the alternative command named \connect that helps us connect to the database. Now, we will connect to the educba database using the meta-command \c and the name of the database. We can use a meta-command named \d, as shown below, to get the database names list. ![]() For example, here, the user is Postgres, whose password is “a”.įurther, after connecting to the database server, we will need to list all the available databases in the database server so that we can choose the one and connect to it and retrieve the tables of that database. The execution of the above command statement gives an output, as shown below, which demands the password as soon as the command is fired, and we need to mention the password set against the user using which we are trying to login. ![]() We will first need to login to our PostgreSQL database server through the terminal using the following command where Postgres is the user name using which I will log in to my Postgres database server, and W is to mention I will enter that password after the execution of the following command.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |