Changing databases / schemas

Поиск
Список
Период
Сортировка
Искать

Changing databases / schemas

От:
"Machiel Richards" <machielr@rdc.co.za>
Дата:

Hi All

 

                I have a question that might seem “blonde” but I am very new to postgres and still trying to find my way around.

 

                I need to work on a system which contains several databases and schemas and the login I am using have access to all the databases and schemas, etc...

 

                However I am struggling to guide my way through the databases,etc... to view the table structures and so on...

 

                What I am trying to find out is the following:

 

·         In MySQL for example you can use “use <database>” and then change between databases which you want to access currently.

o   Is there something similar in Postgres or do you need to disconnect and reconnect to the next database everytime you want to change the current working DB?

·         Once connected to a database , how can I see a list of schemas and in turn a list of tables that are currently available and also how do I see the table info (i.e describe in other dbms systems)

 

I would appreciate any help in this as I tried to google but always seem to just get results for Alter table, etc... (I think my search text might be a bit off L   )

 

 

Regards

Machiel

 

 

 

 

Re: Changing databases / schemas

От:
"Machiel Richards" <machielr@rdc.co.za>
Дата:
Thank you very much, this helps a lot.

Machiel Richards
MySQL DBA
Relational Database Consulting 




-----Original Message-----
From: adam_pgsql [mailto:adam_pgsql@witneyweb.org] 
Sent: 22 February 2010 2:14 PM
To: Machiel Richards
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Changing databases / schemas

> .         In MySQL for example you can use "use " and then
change between databases which you want to access currently.
> o   Is there something similar in Postgres or do you need to disconnect
and reconnect to the next database everytime you want to change the current
working DB?

To connect to a database from psql:
\c 

> .         Once connected to a database , how can I see a list of schemas
and in turn a list of tables that are currently available and also how do I
see the table info (i.e describe in other dbms systems)

For a list of schemas (schemata?):
\dn 

For a list of tables:
\dt .*

For a description of the table:
\d .

For a full list of commands use:
\?

cheers

adam

Re: Changing databases / schemas

От:
adam_pgsql <adam_pgsql@witneyweb.org>
Дата:
> ·         In MySQL for example you can use “use ” and then change between databases which you want to access currently.
> o   Is there something similar in Postgres or do you need to disconnect and reconnect to the next database everytime you want to change the current working DB?

To connect to a database from psql:
\c 

> ·         Once connected to a database , how can I see a list of schemas and in turn a list of tables that are currently available and also how do I see the table info (i.e describe in other dbms systems)

For a list of schemas (schemata?):
\dn 

For a list of tables:
\dt .*

For a description of the table:
\d .

For a full list of commands use:
\?

cheers

adam

FAQ