Re: Typo on tutorial window page

From: Олег Семенов <oselemg(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Typo on tutorial window page
Date: 2025-01-21 17:44:07
Message-ID: CAPuntdKZ0Wqt-09WZgdSb4s86db2fTk4O=_-mxveZ8tSOGozEA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

sorry, my bad, thanks for the clarification!

вт, 21 січ. 2025 р., 18:40 користувач David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> пише:

> On Tue, Jan 21, 2025 at 10:39 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> PG Doc comments form <noreply(at)postgresql(dot)org> writes:
>> > EXPECTED:
>> > As shown here, the rank function produces a numerical rank for each
>> distinct
>> > PARTITION BY value in the current row's partition, using the order
>> defined
>> > by the ORDER BY clause. rank needs no explicit parameter, because its
>> > behavior is entirely determined by the OVER clause.
>>
>> > ACTUAL:
>> > As shown here, the rank function produces a numerical rank for each
>> distinct
>> > ORDER BY value in the current row's partition, using the order defined
>> by
>> > the ORDER BY clause. rank needs no explicit parameter, because its
>> behavior
>> > is entirely determined by the OVER clause.
>>
>> Hmm, I think the current text is correct, or at least more nearly
>> correct than what you suggest.
>
>
>
>
>
>> Look at the example:
>>
>> <programlisting>
>> SELECT depname, empno, salary,
>> rank() OVER (PARTITION BY depname ORDER BY salary DESC)
>> FROM empsalary;
>> </programlisting>
>>
>> <screen>
>> depname | empno | salary | rank
>> -----------+-------+--------+------
>> develop | 8 | 6000 | 1
>> develop | 10 | 5200 | 2
>> develop | 11 | 5200 | 2
>> develop | 9 | 4500 | 4
>> develop | 7 | 4200 | 5
>> personnel | 2 | 3900 | 1
>> personnel | 5 | 3500 | 2
>> sales | 1 | 5000 | 1
>> sales | 4 | 4800 | 2
>> sales | 3 | 4800 | 2
>> (10 rows)
>> </screen>
>>
>> The ranks are separate within each partition (depname), and
>> within a partition rows having the same salary get the
>> same rank.
>>
>> regards, tom lane
>>
>>
>>

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2025-01-21 17:55:31 Re: Typo on tutorial window page
Previous Message David G. Johnston 2025-01-21 17:39:58 Re: Typo on tutorial window page