Informatica Interview Question Part-9 - ETL- iNFORMATICA DEVELOPER

Saturday, June 22, 2019

Informatica Interview Question Part-9

ktnewslive


This feature is similar to entering a custom query in a Source Qualifier transformation. When entering a Lookup SQL Override, you can enter the entire override, or generate and edit the default SQL statement.
The lookup query override can include WHERE clause.


The Source Qualifier provides the SQL Query option to override the default query. You can enter any SQL statement supported by your source database. You might enter your own SELECT statement, or have the database perform aggregate calculations, or call a stored procedure or stored function to read the data and perform some tasks.


v_temp = v_temp+1
o_seq = IIF(ISNULL(v_temp), 0, v_temp)


Source –> SQ –> SRT –> EXP –> FLT OR RTR –> TGT
In Expression:
flag = Decode(true,eid=pre_eid, ‘Y’,'N’)
flag_out = flag
pre_eid = eid


The following are the transaction levels or built-in variables:
·         TC_CONTINUE_TRANSACTION: The Integration Service does not perform any transaction change for this row. This is the default value of the expression.
·         TC_COMMIT_BEFORE: The Integration Service commits the transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.
·         TC_COMMIT_AFTER: The Integration Service writes the current row to the target, commits the transaction, and begins a new transaction. The current row is in the committed transaction.
·         TC_ROLLBACK_BEFORE: The Integration Service rolls back the current transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.
·         TC_ROLLBACK_AFTER: The Integration Service writes the current row to the target, rolls back the transaction, and begins a new transaction. The current row is in the rolled back transaction.



Q. What is difference between grep and find?


Grep is used for finding any string in the file.
Syntax - grep <String> <filename>
Example - grep 'compu' details.txt
Display the whole line,in which line compu string is found.
                                                     
Find is used to find the file or directory in given path,
Syntax - find <filename>
Example - find compu*
Display all file names starting with computer




DDL is Data Definition Language statements
·         CREATE – to create objects in the database
·         ALTER – alters the structure of the database
·         DROP – delete objects from the database
·         TRUNCATE – remove all records from a table, including all spaces allocated for the records are removed
·         COMMENT – add comments to the data dictionary
·         GRANT – gives user’s access privileges to database
·         REVOKE – withdraw access privileges given with the GRANT command

DML is Data Manipulation Language statements
·         SELECT – retrieve data from the a database
·         INSERT – insert data into a table
·         UPDATE – updates existing data within a table
·         DELETE – deletes all records from a table, the space for the records remain
·         CALL – call a PL/SQL or Java subprogram
·         EXPLAIN PLAN – explain access path to data
·         LOCK TABLE – control concurrency

DCL is Data Control Language statements
·       
             COMMIT – save work done
·         SAVEPOINT – identify a point in a transaction to which you can later roll back
·         ROLLBACK – restore database to original since the last COMMIT
·         SET TRANSACTION – Change transaction options like what rollback segment to use



Q. What is Stored Procedure?

A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.

Q. What is View?

A view is a tailored presentation of the data contained in one or more tables (or other views). Unlike a table, a view is not allocated any storage space, nor does a view actually contain data; rather, a view is defined by a query that extracts or derives data from the tables the view references. These tables are called base tables.
Views present a different representation of the data that resides within the base tables. Views are very powerful because they allow you to tailor the presentation of data to different types of users.
Views are often used to:
·         Provide an additional level of table security by restricting access to a predetermined set of rows and/or columns of a table
·         Hide data complexity
·         Simplify commands for the user
·         Present the data in a different perspective from that of the base table
·         Isolate applications from changes in definitions of base tables
·         Express a query that cannot be expressed without using a view


Q. What is Trigger?

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; the DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored Procedures.
Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.

Q. What is View?

A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.

Q. What is Index?

An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance. Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, each database table may
have only one clustered index. Non-clustered indexes are created outside of the database table and contain a sorted list of references to the table itself.

Q. What is the difference between clustered and a non-clustered index?

A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

Q. What is Cursor?


Cursor is a database object used by applications to manipulate data in a set on a row-by row basis, instead of the typical SQL commands that operate on all the rows in the set at one time.
In order to work with a cursor we need to perform some steps in the following order:
·         Declare cursor
·         Open cursor
·         Fetch row from the cursor
·         Process fetched row
·         Close cursor
·         Deallocate cursor

Q. What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?

1. Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement.
2. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.
3. Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.



RANK CACHE

Sample Rank Mapping
When the Power Center Server runs a session with a Rank transformation, it compares an input row with rows in the data cache. If the input row out-ranks a Stored row, the Power Center Server replaces the stored row with the input row.
Example: Power Center caches the first 5 rows if we are finding top 5 salaried Employees. When 6th row is read, it compares it with 5 rows in cache and places it in Cache is needed.
1) RANK INDEX CACHE:
The index cache holds group information from the group by ports. If we are Using Group By on DEPTNO, then this cache stores values 10, 20, 30 etc.
All Group By Columns are in RANK INDEX CACHE. Ex. DEPTNO
2) RANK DATA CACHE:
It holds row data until the Power Center Server completes the ranking and is generally larger than the index cache. To reduce the data cache size, connect only the necessary input/output ports to subsequent transformations.
All Variable ports if there, Rank Port, All ports going out from RANK Transformations are stored in RANK DATA CACHE.
Example: All ports except DEPTNO In our mapping example.



Aggregator Caches
1.   
     The Power Center Server stores data in the aggregate cache until it completes Aggregate calculations.
2.   It stores group values in an index cache and row data in the data cache. If the Power Center Server requires more space, it stores overflow values in cache files.
Note: The Power Center Server uses memory to process an Aggregator transformation with sorted ports. It does not use cache memory. We do not need to configure cache memory for Aggregator transformations that use sorted ports.
1) Aggregator Index Cache:
The index cache holds group information from the group by ports. If we are using Group By on DEPTNO, then this cache stores values 10, 20, 30 etc.
·         All Group By Columns are in AGGREGATOR INDEX CACHE. Ex. DEPTNO
2) Aggregator Data Cache:
DATA CACHE is generally larger than the AGGREGATOR INDEX CACHE.
Columns in Data Cache:
·         Variable ports if any
·         Non group by input/output ports.
·         Non group by input ports used in non-aggregate output expression.
·         Port containing aggregate function


JOINER CACHES
Joiner always caches the MASTER table. We cannot disable caching. It builds Index cache and Data Cache based on MASTER table.
1) Joiner Index Cache:
All Columns of MASTER table used in Join condition are in JOINER INDEX CACHE.
 Example: DEPTNO in our mapping.
2) Joiner Data Cache:
Master column not in join condition and used for output to other transformation or target table are in Data Cache.
 Example: DNAME and LOC in our mapping example.



Lookup Cache Files

1. Lookup Index Cache:
Stores data for the columns used in the lookup condition.
2. Lookup Data Cache:
·         For a connected Lookup transformation, stores data for the connected output ports, not including ports used in the lookup condition.
·         For an unconnected Lookup transformation, stores data from the return port.

No comments:

Post a Comment