Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: This massive query..........
"Arthur" <amerar_at_iwc.net> a écrit dans le message de
news:8b622eae.0407091213.fdb3912_at_posting.google.com...
> Hi all,
>
> I do not understand this query at all. I came across it during some
> web searching, and I'm just curious what the heck it means.....
>
> SELECT c, i, y, m, r, nr
> FROM book_sales s
> PARTITION BY (s.country, s.isbn)
> RIGHT OUTER JOIN month mo ON (s.month = mo.m AND s.year = mo.y)
> WHERE mo.y IN (2002, 2003)
> MODEL
> PARTITION BY (s.country c)
> DIMENSION BY (s.isbn i, mo.y y, mo.m m)
> MEASURES (s.net_revenue r, CAST(NULL AS NUMBER) nr)
> RULES (
> --Generate monthly sales for missing months (densification)
> nr[ANY, ANY, ANY]
> = CASE WHEN r[CV(), CV(), CV()] IS NOT NULL
> THEN r[CV(), CV(), CV()]
> ELSE ROUND(AVG(r)[CV(), CV(), m BETWEEN 1 AND 12],2)
> END
> )
> ORDER BY c, i, y, m;
>
>
> Thanks,
>
> Arthur
It gives, for each country (c), isbn (i), year (y), month (m), the revenue (r) and, in nr field, the revenue another time if it is not null else the average of the revenue over the current year.
-- Regards Michel CadotReceived on Fri Jul 09 2004 - 16:01:06 CDT