Обсуждение: newbie qs; examining databases and tables

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

newbie qs; examining databases and tables

От
Rusty Wright
Дата:
I'm someone with some mysql experience and need to set up postgres for
a product we're evaluating.  In mysql I can use SHOW DATABASES to list
all of the databases on the system, USE DB1 to switch to one of the
databases, SHOW TABLES to list all of the table names in the database
I'm USEing, and DESCRIBE TABLE1 to list all of the column names, data
types, etc. for a table.

How do I do the equivalent with postgresql?  Are there equivalent SQL
commands?

Re: newbie qs; examining databases and tables

От
Andrew Perrin
Дата:
SHOW DATABASES  --> \l
USE DB1         --> \c db1
SHOW TABLES     --> \d
DESCRIBE TABLE1 --> \d table1

ap

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu


On Tue, 15 Oct 2002, Rusty Wright wrote:

> I'm someone with some mysql experience and need to set up postgres for
> a product we're evaluating.  In mysql I can use SHOW DATABASES to list
> all of the databases on the system, USE DB1 to switch to one of the
> databases, SHOW TABLES to list all of the table names in the database
> I'm USEing, and DESCRIBE TABLE1 to list all of the column names, data
> types, etc. for a table.
>
> How do I do the equivalent with postgresql?  Are there equivalent SQL
> commands?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


Re: newbie qs; examining databases and tables

От
Rusty Wright
Дата:
Ok, thanks.

Re: newbie qs; examining databases and tables

От
"Ross J. Reedstrom"
Дата:
On Mon, Oct 21, 2002 at 11:22:31AM -0700, Rusty Wright wrote:
> Ok, thanks.

and one more:

\? -- lists 'slash' commands

And just in case it comes up:

launch psql with the -E switch, to see the SQL queries that
are performed to get that data.

Ross