doubt about the database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • maridu h.s.n.v.prasad

    #1

    doubt about the database

    subscribe
    end

    hai sir
    i am using the postgresql 7.2 my doubt is
    what is the command of to see the list of databases
    i create a database named "jntuoes"
    database created it's displayed
    but i want to know the command
    so please give me the replay

    thak you sir



    _______________ _______________ _
    Do you Yahoo!?
    Declare Yourself - Register online to vote today!


    ---------------------------(end of broadcast)---------------------------
    TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddres sHere" to majordomo@postg resql.org)

  • Scott Marlowe

    #2
    Re: doubt about the database

    On Sun, 2004-09-26 at 01:49, maridu h.s.n.v.prasad wrote:[color=blue]
    > subscribe
    > end
    >
    > hai sir
    > i am using the postgresql 7.2 my doubt is
    > what is the command of to see the list of databases
    > i create a database named "jntuoes"
    > database created it's displayed
    > but i want to know the command
    > so please give me the replay[/color]

    in psql, you use \l

    smarlowe=> \l
    List of databases
    Name | Owner | Encoding
    -----------+----------+-----------
    blog | smarlowe | SQL_ASCII
    postgres | postgres | SQL_ASCII
    smarlowe | smarlowe | SQL_ASCII
    template0 | postgres | SQL_ASCII
    template1 | postgres | SQL_ASCII
    (5 rows)

    If you want to execute a command to see it from SQL (i.e. an application
    etc...) you can find the queries psql uses by starting it with the -E
    switch, like so:

    [smarlowe@localh ost smarlowe]$ psql -E
    Welcome to psql 7.4.5, the PostgreSQL interactive terminal.

    Type: \copyright for distribution terms
    \h for help with SQL commands
    \? for help on internal slash commands
    \g or terminate with semicolon to execute query
    \q to quit

    smarlowe=> \l
    ********* QUERY **********
    SELECT d.datname as "Name",
    u.usename as "Owner",
    pg_catalog.pg_e ncoding_to_char (d.encoding) as "Encoding"
    FROM pg_catalog.pg_d atabase d
    LEFT JOIN pg_catalog.pg_u ser u ON d.datdba = u.usesysid
    ORDER BY 1;
    *************** ***********

    List of databases
    Name | Owner | Encoding
    -----------+----------+-----------
    blog | smarlowe | SQL_ASCII
    postgres | postgres | SQL_ASCII
    smarlowe | smarlowe | SQL_ASCII
    template0 | postgres | SQL_ASCII
    template1 | postgres | SQL_ASCII
    (5 rows)

    Hope that helps.


    ---------------------------(end of broadcast)---------------------------
    TIP 7: don't forget to increase your free space map settings

    Comment

    Working...