Thor
Thor

Reputation: 10038

what is a "window descriptor" in tsql window function

I'm currently learning tsql window function by following the book tsql fundamental by Ben Itzik.

In the section that explain what a window is in terms of window function, the author used the term window descriptor

enter image description here

Could someone please explain to me what window descriptor means and represents?

Upvotes: 0

Views: 102

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1269753

The "window descriptor" is the part that starts with ROWS BETWEEN or RANGE BETWEEN.

In many uses of window functions, this is implicit. So:

select sum(x) over (order by y)

is really a shorthand for:

select sum(x) over (order by y rows between unbounded preceding and current row)

(or is that range between ;).

And:

select sum(x) over ()

is short-hand for:

select sum(x) over (rows between unbounded preceding and unbounded following)

Upvotes: 1

Aasish Kr. Sharma
Aasish Kr. Sharma

Reputation: 556

As it is clearly written that a window function is a function that will operate on the basis of described formula or calculation from the over() clause and will give out the scalar result after processing every row of the selected window (rows set). So, Window Descriptor means it specifies how window rows should be selected in window function.

Upvotes: 2

Related Questions