Aggregate function to aggregate function page 1 |
||
|
Let us consider this exercise: Find the maximum value among the average prices of PCs, counted separately for each manufacturer. Calculation of average cost for makers is not difficult:
However, the standard prohibits the use of a subquery as an argument to aggregate function, i.e. we can not solve the exercise by this way:
In such cases, use a subquery in the FROM clause:
By means of new features of language - window functions - this problem can be solved without a subquery:
Note that window functions admit use of aggregate function as argument. DISTINCT keyword is necessary here because the maximal value, which has been counted up over all set of average values, will be "attributed" to each manufacturer. |
||
| Пусеты с рубинами |
| Серьги, кольца, подвески, колье и проч. Каталог с фотографиями. |
| goldbowl.ru |
| Разработка и продвижение веб сайтов |
| Портфолио выполненных работ. Контактная информация. |
| webtema.ru |


