Reporting Flashcards

Reporting

1
Q

Cumulative Aggregate

A

TO_CHAR(sum(sum(xxx))OVER(order by yyy rows unbounded preceding), ‘999999999’) AS CUMREV

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Cumulative Aggregate & Single Partition

A

TO_CHAR(sum(sum(xxx)))OVER(partition by yyy order by yyy rows unbounded preceding),’999999999’) AS CUMREV

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Cumulative Aggregate & Multiple Partition

A

TO_CHAR(sum(sum(xxx)))OVER(partition by yyy order by yyy rows unbounded preceding),’999999999’)AS CUMREV1 (x2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Moving Aggregate

A

TO_CHAR(avg(sum(xxx))OVER(order by yyy rows 2 preceding), ‘999999999’) AS MOV3MONTHSAVG

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Cumulative - 3 key points

A

SUM, Rows Unbounded Preceding, Cumulative_Rev

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Moving - 3 Points

A

AVG, Rows X Preceding, MOV_(x+1)_AVG

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Rank Over

A

RANK()OVER(order by sum(xxx) desc) AS RANK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Rank Over With Partition

A

RANK()OVER(partition by yyy order by sum(xxx) desc) AS RANK_BY_PARTITION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Row Number

A

ROW_NUMBER()OVER(order by sum(xxx) desc) AS ROW_NUM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Dense Rank

A

DENSE_RANK()OVER(order by sum(xxx) desc) AS DENSE_RANK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Rank Function

A
Select *
From (
 Select AAA,  BBB,  
 SUM(xxx) AS TOTAL,
 RANK()OVER(...) AS RANK
 FROM(...)
 WHERE(...)
 GROUP BY AAA,  BBB) 
WHERE RANK <= x
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Percent Rank Function

A
Select dw.time_id, total, percent_rank
FROM (
 Select time_id, sum(xxx) AS total, 
 Percent()rank over(...) AS perc_rank
 FROM fact
 GROUP BY time_id) t,  dw
WHERE t.time_id = dw.time_id
AND percent_rank >= 0.9
ORDER BY percent_rank desc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Grouping and Cube

A
SELECT aaa, bbb,  ccc, sum(xxx),
GROUPING (aaa)  AS aaaGroup, 
GROUPING (bbb)  AS bbbGroup, 
GROUPING (ccc)  AS cccGroup
FROM (...)
WHERE (...)
GROUP BY CUBE (aaa, bbb, ccc) 
ORDEE BY aaa
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Cube

A
SELECT aaa, bbb,  ccc,  sum(xxx)
FROM (...)
WHERE (...)
GROUP BY CUBE (aaa, bbb, ccc) 
ORDER BY aaa
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Partial Cube

A
SELECT aaa, bbb,  ccc,  sum(xxx)
FROM (...)
WHERE (...)
GROUP BY CUBE (aaa, bbb),ccc 
ORDER BY aaa
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Rollup

A
SELECT aaa, bbb,  ccc,  sum(xxx)
FROM (...)
WHERE (...)
GROUP BY CUBE (aaa, bbb),ccc 
ORDER BY aaa
17
Q

Partial Rollup

A
SELECT aaa, bbb,  ccc,  sum(xxx)
FROM (...)
WHERE (...)
GROUP BY ROLLUP (aaa, bbb), ccc
ORDER BY aaa
18
Q

About Cube (3 Points)

A

cross tabular reports, generates subtotals for all combos, n-columns (2^n subtotal combos)

19
Q

About Rollup

A

Grand Subtotals and grand total, n-columns (n+1 subtotals) , maintain hierarchy

20
Q

Partial Rollup and Grouping and Decoding

A

SELECT
DECODE(grouping(aaa), 1, ‘all aaa’, aaa) as aaa,
DECODE(grouping(bbb), 1, ‘all bbb’, bbb) as bbb,
DECODE(grouping(ccc), 1, ‘all ccc’, ccc) as ccc,
Sum(xxx)
From (…)
Where (…)
Group by rollup (aaa, bbb), ccc
Ordee by aaa

21
Q

Order by multiple descending

A

Order By AAA desc, BBB desc