Thread: Re: Newbie question: How to check how many tables avaliable at that database?

Re: Newbie question: How to check how many tables avaliable at that database?

From
Nils Zonneveld
Date:

Carfield Yim wrote:
>
> I am a  new user of PostgreSQL dbms, how can I check how many tables
> avaliable at that database?

To get a list of tables through SQL:

SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%' ORDER BY tablename;

To get the number of tables through SQL:

SELECT count(*) FROM pg_tables WHERE tablename NOT LIKE 'pg_%';


HTH,

Nils Zonneveld

On Wed, Jun 13, 2001 at 07:25:46PM +0200, Nils Zonneveld wrote:
>
>
> Carfield Yim wrote:
> >
> > I am a  new user of PostgreSQL dbms, how can I check how many tables
> > avaliable at that database?
>
> To get a list of tables through SQL:
>
> SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%' ORDER BY tablename;
>
> To get the number of tables through SQL:
>
> SELECT count(*) FROM pg_tables WHERE tablename NOT LIKE 'pg_%';

to learn more of these tricks, start 'psql' with '-E' as in

    psql -E mydatabasenamehere

then when you give any '\d' command you'll see the sql behind
the scenes that does the work.

also try '\?' for more info on using psql.

--
I figure: if a man's gonna gamble, may as well do it
without plowing.   -- Bama Dillert, "Some Came Running"

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!