Обсуждение: 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

От
Rusty Wright
Дата:
Sorry, nevermind; I discovered \? and figured it out.

Re: newbie qs; examining databases and tables

От
"Devinder K Rajput"
Дата:
log into psql using: psql db_name (from the command line)
\d: Lists all tables in the current database (SHOW TABLES)
\d table_name: lists all columns of the given table ( DESCRIBE table_name)
\c new_db_name: switches connection to new database (USE db_name)
\?: will list available commands
\h: will list available SQL command
\h sql_command_name: will display usage about the given sql command

from linux command line, issue: psql -l ( lists all available databases,
including Template)

regards

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474



   
                    "Rusty Wright"
   
                    <rusty@socrates.Berkel       To:     pgsql-admin@postgresql.org
   
                    ey.EDU>                      cc:
   
                    Sent by:                     Subject:     [ADMIN] newbie qs; examining databases and tables
   
                    pgsql-admin-owner@post
   
                    gresql.org
   

   

   
                    10/15/2002 06:27 PM
   

   

   




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 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)






Re: newbie qs; examining databases and tables

От
"Devinder K Rajput"
Дата:
no problem.  I myself am relatively new to postgres.   The users on list
are very responsive whenever they can help.  I'm doing the same and trying
to put in my 2 cents.  Thanks guys!

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474




                    "Rusty Wright"

                    <rusty@socrates.Ber       To:     Devinder.Rajput@ipaper.com

                    keley.EDU>                cc:

                                              Subject:     Re: [ADMIN] newbie qs; examining databases and tables

                    10/16/2002 02:40 PM









Great, thanks.