Computer Knowledge
Database and SQL
4,213 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
A
Correct answer
Explanation
TRUNCATE is classified as DDL because it resets table storage and cannot be rolled back, unlike DELETE which is DML. DDL commands implicitly commit and modify database structure or metadata. This distinction is crucial for understanding transaction behavior and data recovery options.
A
Correct answer
Explanation
DDL (Data Definition Language) commands define and modify database structures like tables, indexes, and schemas. DML (Data Manipulation Language) manipulates actual data with commands like INSERT, UPDATE, DELETE. DCL (Data Control Language) controls access permissions (GRANT, REVOKE), while TCL (Transaction Control Language) manages transactions (COMMIT, ROLLBACK).
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.