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

Started by Carfield Yimalmost 25 years ago4 messagesgeneral
Jump to latest
#1Carfield Yim
carfield@programmer.net

I am a new user of PostgreSQL dbms, how can I check how many tables
avaliable at that database?
--

Carfield Yim, visit my homepage at http://www.carfield.com.hk

#2Nils Zonneveld
nils@mbit.nl
In reply to: Carfield Yim (#1)
Re: Newbie question: How to check how many tables avaliable at that database?

Carfield Yim wrote:

I am a new user of PostgreSQL dbms, how can I check how many tables
avaliable at that database?

In the psql tool use \dt

HTH,

Nils

#3Nils Zonneveld
nils@mbit.nl
In reply to: Carfield Yim (#1)
Re: Newbie question: How to check how many tables avaliable at that database?

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

#4will trillich
will@serensoft.com
In reply to: Nils Zonneveld (#3)
Re: Re: Newbie question: How to check how many tables avaliable at that database?

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!