Sunday 22 January 2017

1) What is a level of Granularity of a fact table?

Level of granularity means level of detail of data available in the fact table

For an instance
in the fact table sales data may available at minute level or day level or month level....

High Granularity: data available at low level EX: Day level.
Low Granularity: data available at high level EX: Month level.



2) DIFFERENCE BETWEEN CO-RELATED SUB QUERY AND NESTED SUB QUERY


Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value from the row selected by the outer query.
Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the outer query row.
For example,
Correlated Subquery:
Select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno)
Nested Subquery:
Select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno

No comments:

Post a Comment