pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
to count no of columns in a table
4+ messages / 4 participants
[nested] [flat]

* to count no of columns in a table
@ 2006-02-16 09:13 AKHILESH GUPTA <akhilesh.davim@gmail.com>
  2006-02-16 09:34 ` Re: to count no of columns in a table Juris <bubliks@gmail.com>
  2006-02-16 09:37 ` Re: to count no of columns in a table A. Kretschmer <andreas.kretschmer@schollglas.com>
  2006-02-16 09:40 ` Re: [SQL] to count no of columns in a table Ragnar <gnari@hive.is>
  0 siblings, 3 replies; 4+ messages in thread

From: AKHILESH GUPTA @ 2006-02-16 09:13 UTC (permalink / raw)
  To: pgsql-general@postgresql.org; pgsql-sql

hi all,
i just want to know one thing that is there any function in PGSQL which
gives me the total number of columns in a table.
OR
just like we are using count(*), it gives us total number or rows in a
table, just like i want to know the total number of columns present in the
table
plz help me it's urgent
THANKS IN ADVANCE............!

--
Thanks & Regards,
Akhilesh
DAV Institute of Management
Faridabad(Haryana)-INDIA

"FAILURES CAN BE FORGIVEN BUT AIMING LOW IS A CRIME"

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: to count no of columns in a table
  2006-02-16 09:13 to count no of columns in a table AKHILESH GUPTA <akhilesh.davim@gmail.com>
@ 2006-02-16 09:34 ` Juris <bubliks@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Juris @ 2006-02-16 09:34 UTC (permalink / raw)
  To: AKHILESH GUPTA <akhilesh.davim@gmail.com>; +Cc: pgsql-sql

Create view/storedproc on  pg_class & pg_attribute  tables

2006/2/16, AKHILESH GUPTA <akhilesh.davim@gmail.com>:
> hi all,
>  i just want to know one thing that is there any function in PGSQL which
> gives me the total number of columns in a table.
>  OR
>  just like we are using count(*), it gives us total number or rows in a
> table, just like i want to know the total number of columns present in the
> table
>  plz help me it's urgent
>  THANKS IN ADVANCE............!
>
>  --
>  Thanks & Regards,
>  Akhilesh
>  DAV Institute of Management
>  Faridabad(Haryana)-INDIA
>
>  "FAILURES CAN BE FORGIVEN BUT AIMING LOW IS A CRIME"
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: to count no of columns in a table
  2006-02-16 09:13 to count no of columns in a table AKHILESH GUPTA <akhilesh.davim@gmail.com>
@ 2006-02-16 09:37 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
  2 siblings, 0 replies; 4+ messages in thread

From: A. Kretschmer @ 2006-02-16 09:37 UTC (permalink / raw)
  To: pgsql-sql

am  16.02.2006, um 14:43:43 +0530 mailte AKHILESH GUPTA folgendes:
> hi all,
> i just want to know one thing that is there any function in PGSQL which
> gives me the total number of columns in a table.

select count(column_name) from information_schema.columns where table_name='foo';


HTH, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [SQL] to count no of columns in a table
  2006-02-16 09:13 to count no of columns in a table AKHILESH GUPTA <akhilesh.davim@gmail.com>
@ 2006-02-16 09:40 ` Ragnar <gnari@hive.is>
  2 siblings, 0 replies; 4+ messages in thread

From: Ragnar @ 2006-02-16 09:40 UTC (permalink / raw)
  To: AKHILESH GUPTA <akhilesh.davim@gmail.com>; +Cc: pgsql-general@postgresql.org; pgsql-sql

On fim, 2006-02-16 at 14:43 +0530, AKHILESH GUPTA wrote:
> i just want to know one thing that is there any function in PGSQL
> which gives me the total number of columns in a table.
> OR
> just like we are using count(*), it gives us total number or rows in a
> table, just like i want to know the total number of columns present in
> the table

this is the kind of thing the information_schema is for

  select count(*) from information_schema.columns 
                  where table_name='x';


gnari





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-02-16 09:40 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-16 09:13 to count no of columns in a table AKHILESH GUPTA <akhilesh.davim@gmail.com>
2006-02-16 09:34 ` Juris <bubliks@gmail.com>
2006-02-16 09:37 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2006-02-16 09:40 ` Ragnar <gnari@hive.is>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox