Bridge Table Flashcards

Bridge

1
Q

Create a dimension which includes a weight factor and listagg.

A

CREATE TABLE leftDIM AS SELECT leftID, leftxxx, leftyyy, 1.0/count(rightID) as weightFactor, LISTAGG(rightID, ‘__’) WITHIN GROUP (Order By rightID) AS rightGroupList FROM (…) WHERE (…) GROUP BY leftID, leftxxx, leftyyy

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

What is the total cost for each right?

A

Select rightID, rightXXX, sum(totalCost * weight) AS total_cost_right FROM fact, left, bridge, right where fact.id = left.id and left.id = bridge.id and bridge.id = right.id group by rightID, rightXXX, order by rightID, rightXXX

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

Weightfactor

A

1.0/count(rightID) AS weightFactor

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

ListAGG

A

ListAGG(rightID, ‘__’) within group (order by rightid) as rightGroupList

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

ListAGG

A

ListAGG(rightID, ‘__’) within group (order by rightid) as rightGroupList

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

Create another version of a dimension with listagg and weight factor that has an increased level of aggregation

A

Create table leftDim as 1.0/count(rightID) as weightFactor, LISTAGG(rightID, ‘__’) within group (order by rightID) as rightGroupList from (…) where (…)

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

Create a bridge dim with increased aggregation using listagg

A

Create table bridgeDim as select listagg(rightID, ‘__’) within group (order by rightID) as rightGroupList, rightID from (…) where(…) group by rightID

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

Create a bridge dim

A

Select leftID, rightID from (…) where (…) group by leftID, rightID

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

Draw sample records for a ProductDim (ProdNo, ProdType) and Bridge (ProductNo, SupplierID) and SupplierDim (SupplierID, SupplierName) with weightFactor and listagg

A

draw

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