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

Multiple choice technology databases
  1. DDL

  2. DML

  3. DCL

  4. TCL

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. DDL

  2. DML

  3. DCL

  4. TCL

Reveal answer Fill a bubble to check yourself
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).

Multiple choice technology
  1. 1

  2. 2

  3. 3

  4. 4

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology
  1. 1

  2. 2

  3. 3

  4. 4

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology
  1. Card_Pers_Enhanced

  2. Card_Runstat

  3. None of the above

  4. all of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology
  1. CARD_PERS_ENHANCED

  2. CARD_RUNSTAT

  3. CARD_ACCT_XREF

  4. CARD_LOOKUP

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology
  1. External-cm-no

  2. Internal-cm-no

  3. Cust-acct-ky

  4. pcn-no

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. Weak entity

  2. Strong entity

  3. ID-dependent entity

  4. ID-independent entity

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology
  1. Yes

  2. No

  3. May be

  4. Not sure

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology
  1. Yes

  2. No

  3. Lookup is not filtering it will throw error

  4. Need to write override query

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. Equi-join

  2. Natural join

  3. Outer join

  4. Cartesian join

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. Hard-coded SQL statements in a program language such as Java

  2. The process of making an application capable of generating specific SQL code on the fly.

  3. Hard-coded SQL statements in a procedure.

  4. Hard-coded SQL statements in a trigger.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. Combines the output from no more than two queries and must include the same number of columns.

  2. Combines the output from no more than two queries and does not include the same number of columns.

  3. Combines the output from multiple queries and must include the same number of columns.

  4. Combines the output from multiple queries and does not include the same number of columns.

Reveal answer Fill a bubble to check yourself
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.