Computer Knowledge
Database and SQL
3,929 Questions
Master structured query language commands, database joins, table constraints, and alias generation. This section covers relational database management concepts and query outputs essential for technical aptitude. These technical questions feature prominently in banking IT officer exams and computer knowledge sections.
SQL queries and aliasesDatabase table constraintsDatabase joins and transformationsStored procedures and functions
Database and SQL Questions
B
Correct answer
Explanation
In ETL tools like DataStage, the Join component defaults to accepting two input streams (left and right links). This binary join operation merges data from two sources based on key values, making the default count equal to 2.
B
Correct answer
Explanation
The default count for the Join component is 2. This means that by default, the Join operation combines two input flows. If you need to join more than two flows, you must explicitly change the count parameter to match the number of inputs.
-
Card_Pers_Enhanced
-
Card_Runstat
-
None of the above
-
all of the above
D
Correct answer
Explanation
Active card information in CMHDB is stored across multiple tables including Card_Pers_Enhanced (enhanced personal card data) and Card_Runstat (card running statistics/usage data). Both tables contain different aspects of active card information, hence all of the above is correct.
-
CARD_PERS_ENHANCED
-
CARD_RUNSTAT
-
CARD_ACCT_XREF
-
CARD_LOOKUP
A
Correct answer
Explanation
CARD_PERS_ENHANCED (Card Person Enhanced) stores comprehensive demographic details about customers. The ENHANCED suffix indicates expanded profile information. CARD_RUNSTAT contains status data, CARD_ACCT_XREF maps relationships, and CARD_LOOKUP provides reference data.
-
External-cm-no
-
Internal-cm-no
-
Cust-acct-ky
-
pcn-no
C
Correct answer
Explanation
CMHDB uses Cust-acct-ky (Customer Account Key) as the generated key for card identification. This is a composite key that uniquely identifies customer-account relationships. External-cm-no and Internal-cm-no are identifiers, while pcn-no is a different numbering system.
-
Weak entity
-
Strong entity
-
ID-dependent entity
-
ID-independent entity
A
Correct answer
Explanation
A weak entity depends on another entity for its existence but has its own partial key, called a discriminator, that distinguishes instances of the weak entity that share the same parent entity. This differs from an ID-dependent entity, which requires the parent's identifier as part of its own composite key. Strong entities exist independently, while ID-independent entities have no dependency.
C
Correct answer
Explanation
In IMS DL/I databases, attempting to insert a segment that already exists (based on a unique sequence field) returns the 'II' (Invalid Insert) status code. 'IX' and 'ID' are other DL/I status codes but do not represent duplicate insertion.
B
Correct answer
Explanation
DataStage requires key columns (typically primary keys) to identify which rows to update in the target. Without keys defined, the update operation cannot determine which specific rows should be modified.
-
Yes
-
No
-
Lookup is not filtering it will throw error
-
Need to write override query
A
Correct answer
Explanation
In Informatica, a Lookup transformation can be used to filter records. For example, if a lookup finds no match (returning NULL values), subsequent transformations (like a Filter) can drop those records based on the lookup's output. Thus, filtering via lookup is possible.
-
Equi-join
-
Natural join
-
Outer join
-
Cartesian join
A
Correct answer
Explanation
The query uses the equality operator (=) in the WHERE clause to match keys from both tables, which defines an equi-join. It is not a natural join because it explicitly names the joining columns rather than matching implicitly.
-
Hard-coded SQL statements in a program language such as Java
-
The process of making an application capable of generating specific SQL code on the fly.
-
Hard-coded SQL statements in a procedure.
-
Hard-coded SQL statements in a trigger.
A
Correct answer
Explanation
Embedded SQL refers to hard-coding SQL statements directly within a host programming language like Java, C, or COBOL. The SQL statements are mixed with the application code and processed by a precompiler before compilation. Dynamic SQL (option B) is different - it generates SQL at runtime.
-
Combines the output from no more than two queries and must include the same number of columns.
-
Combines the output from no more than two queries and does not include the same number of columns.
-
Combines the output from multiple queries and must include the same number of columns.
-
Combines the output from multiple queries and does not include the same number of columns.
C
Correct answer
Explanation
A UNION query combines results from multiple SELECT statements into a single result set. Key requirements: all queries must have the same number of columns, columns must be in the same order, and data types must be compatible. The 'no more than two' limitation in options A and B is incorrect.
-
Equi-join
-
Natural join
-
Outer join
-
All of the above.
C
Correct answer
Explanation
Outer joins are specifically designed to include rows that don't have matching values in the joined table. This includes LEFT JOIN (all from left table), RIGHT JOIN (all from right table), and FULL JOIN (all from both). Inner joins and equi-joins only return matching rows.
-
Both consist of procedural code
-
Both have to be called to operate.
-
Both run automatically.
-
Both are stored in the database.
A
Correct answer
Explanation
Both routines (stored procedures/functions) and triggers contain procedural code - SQL statements with control flow logic like IF/ELSE, loops, and variables. The key difference is invocation: routines must be called explicitly, while triggers execute automatically in response to events. Option A correctly identifies their shared characteristic.
-
Uses the result of an inner query to determine the processing of an outer query.
-
Uses the result of an outer query to determine the processing of an inner query.
-
Uses the result of an inner query to determine the processing of an inner query.
-
Uses the result of an outer query to determine the processing of an outer query.
B
Correct answer
Explanation
A correlated subquery is one where the inner query references a value from the outer query, making it dependent on the outer query's results. The inner query is executed repeatedly for each row processed by the outer query. This is the opposite of a non-correlated subquery, which runs independently once.