hariharan


{ City } chennai
< Country > india
* Profession *
User No # 98415
Total Questions Posted # 3
Total Answers Posted # 4

Total Answers Posted for My Questions # 10
Total Views for My Questions # 27430

Users Marked my Answers as Correct # 12
Users Marked my Answers as Wrong # 21
Questions / { hariharan }
Questions Answers Category Views Company eMail

What is the difference between SI and JI?

2 Teradata 6356

I have a employee table with EMPID, EMPNAME, DEPTID, SAL and want to fetch the maximum and minimum salary on each dept id with the emp name. Can anyone help in this? The result should contain the EMPNAME, DEPTID, SAL.

Cap Gemini,

4 Teradata 12334

I have a table with emp id, emp name, dept id and sal where dept id is NUSI. SEL * FROM EMP WHERE DEPTID = 100. Can any one explain how it will fetch the record.

4 Teradata 8740




Answers / { hariharan }

Question { CTS, 10818 }

What are the different types of Fatcs?
Explain with example only


Answer

There are four types of facts available in it.
1) Factless Fact
2) Coverage Fact
3) Incident Fact
4) Snapshot fact

Examples :
1) Factless fact:
Consider a school, where a single student may be taught by
many teachers and a single teacher may have many students.
To model this situation in dimensional model, one might
introduce a fact-less-fact table joining teacher and
student keys. Such a fact table will then be able to answer
queries like,
a. Who are the students taught by a specific teacher.
b. Which teacher teaches maximum students.
c. Which student has highest number of teachers.etc. etc.

2) Coverage fact:
A fact-less-fact table can only answer 'optimistic' queries
(positive query) but can not answer a negative query. Again
consider the illustration in the above example. A fact-less
fact containing the keys of tutors and students can not
answer a query like below,
a. Which teacher did not teach any student?
b. Which student was not taught by any teacher?

Why not? Because fact-less fact table only stores the
positive scenarios (like student being taught by a tutor)
but if there is a student who is not being taught by a
teacher, then that student's key does not appear in this
table, thereby reducing the coverage of the table

Coverage fact table attempts to answer this - often by
adding an extra flag column. Flag = 0 indicates a negative
condition and flag = 1 indicates a positive condition. To
understand this better, let's consider a class where there
are 100 students and 5 teachers. So coverage fact table
will ideally store 100 X 5 = 500 records (all combinations)
and if a certain teacher is not teaching a certain student,
the corresponding flag for that record will be 0.

3) Incident Fact:
A fact table stores some kind of measurements. Usually
these measurements are stored (or captured) against a
specific time and these measurements vary with respect to
time. This is example of an Incident Fact.

4) Snapshot Fact:
Take the example of the incident fact. Now it may happen
that the business might not able to capture all of its
measures always for every point in time. The above
unavailable measurements can be kept empty (Null) or can be
filled up with the last available measurements. This is the
example of snapshot fact.

Is This Answer Correct ?    1 Yes 10 No

Question { CTS, 4833 }

If we execute an query in MLOAD it's ran successfully,
my questions is after successfully ran MLOAD. In error
tables we can see anything there! is it possible than what
are they?


Answer

Mload is designed in a way that the error tables are
automatically dropped once the utility ran successfully. If
the job fails during mload, we can see the error tables with
the help of Errorcode, errorfield, uniqueness attributes.

Is This Answer Correct ?    0 Yes 0 No


Question { CTS, 15030 }

i have column like below

studentid studentname sub1 sub2 sub3
1 aaa 40 70 90
2 bbb 60 80 50
i want to execute every student highest mark in which subject
my o/p like below
studentid studentname sub3 sub2
1 aaa 90
2 bbb 80


Answer

sel
studentid,
studentname,
case
when subject1>subject2 and subject1>subject3
then subject1
when subject2>subject1 and subject2>subject3
then subject2
when subject3>subject1 and subject3>subject2
then subject3
end as high_score,
case
when high_score = subject1
then 'subject1'
when high_score = subject2
then 'subject2'
when high_score = subject3
then 'subject3'
end as subject_name
from stud1
order by 1,2
;

Is This Answer Correct ?    3 Yes 0 No

Question { Cap Gemini, 12334 }

I have a employee table with EMPID, EMPNAME, DEPTID, SAL
and want to fetch the maximum and minimum salary on each
dept id with the emp name. Can anyone help in this? The
result should contain the EMPNAME, DEPTID, SAL.


Answer

sel empname, a.deptid, b.salary
from t1_metadata.emp_test a,
(
sel
deptid, max(sal)
from t1_metadata.emp_test
group by 1
union
sel
deptid, min(sal)
from t1_metadata.emp_test
group by 1
)b (deptid, salary)
where a.deptid = b.deptid
and a.sal=b.salary

Is This Answer Correct ?    8 Yes 11 No