Re: select count(*);

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема Re: select count(*);
Дата
Msg-id B6F6FD62F2624C4C9916AC0175D56D8828BE7FD1@jenmbs01.ad.intershop.net
обсуждение исходный текст
Ответ на Re: select count(*);  (Chris Mair <chris@1006.org>)
Ответы Re: select count(*);  (Geoff Winkless <pgsqladmin@geoff.dj>)
Re: select count(*);  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> > 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Mair
Дата:
Сообщение: Re: select count(*);
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: Planner cost adjustments