Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Sunday, December 26, 2010

Display Odd/ Even number of records?


Display Odd/ Even number of records?

i:Odd number of records:
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
Output:-
1
3
5
Even number of records:
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
Output:-
2
4
6

ii) for even number of records

select*from emp where rowid in(select decode(mod(rownum,2),0,rowid) from emp);


for odd number of records


select*from emp where rowid in(select decode(mod(rownum,2),1,rowid) from emp);

Can a primary key contain more than one columns?


yes.. 
                                              A PRIMARY KEY is meant for one column.. If a PRIMARY KEY is defined on more than one column then it is called COMPOSITE PRIMARY KEY.. if you have a table having course id and student id where as one student can apply for many courses and in such a way you can define PRIMARY KEY on both columns like COURSEID AND STUDENTID.

What is a view?


Question : What is a view?

                           View is a logical table which based on one or more than one table or anather view. The table(s) on which view creats are called as base table(s). It does not have it's own data rather it shows the data from the base table(s).

                           View is a virtual table based on the result set of an SQL statement.It contains rows and columns just like real table.

Thursday, December 23, 2010

Some interview Questions


1. How can you recognize whether or not the newly added rows in the source are gets insert in the target?

Version number
Flag value
Effective date Range 

2.What is the use of incremental aggregation? Explain me in brief with an example. 

                        Captured changes in the source to aggregate calculations in a session. If the source changes only incrementally and you can capture changes, you can configure the session to process only those changes. This allows the Informatica Server to update your target incrementally,

3.What is the difference between stop and abort? 
 
                                         In this case data query from source databases is stopped immediately but whatever data has been loaded into buffer there transformations and loading contunes.Abort: Same as Stop but in this case maximum time allowed for buffered data is 60 Seconds.

4.What is the Confirmed Dimensions?

Conformed Dimensions: The dimension which gives the same meaning across different star schemas is called Conformed dimension.

5.About DTM?
D.T.M. [Data Transformation Manager]: It is responsible for modifying the data according to the transformation rule given in the mapping. it stores the data in temporary memory call staging area.[buffer]. Where data transformation activities takes place.

6.Type of Dimensions? 

Fact constellation: its process of joining two fact tables.

Conformed dimension: a dimension table which can be shared by multiple fact tables is known as conformed dimension [common dimension].

Fact less fact table: a fact table without any fact is known as fact less fact table.

Junk dimensions: a dimension with a type a flag, bullion and description or not used to describe the key performance indicators are known as Junk dimensions.


Dirty dimensions: in a dimension table if a record existing more than once with difference non key attribute is known as dirty dimensions.