Search Postgresql Archives

Re: select count(*);

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > select *;
> > ----------
> > ERROR:  SELECT * with no tables specified is not valid
> >
> > select count(*);
> > ----------------
> > 1
> >
> > Is this a must? and why 1?
> 
> Hi,
> 
> regarding the "why 1" part:
> 
> I think that if we accept that
> 
> chris=> select 'foo';
>  ?column?
> ----------
>  foo
> (1 row)
> 
> returns 1 row, then naturally
> 
> chris=> select count('foo');
>  count
> -------
>      1
> (1 row)
> 
> should give a count of 1...
> 
> The * might be a bit tricky, though,
> since 'select *;' doesn't work.

That's the point. * has no meaning without FROM

Marc


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux