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. No rows will be displayed

  2. 0

  3. 16

  4. None

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The count(*) aggregate produces one row. HAVING 1=10 evaluates to FALSE, which eliminates this single aggregated row. When HAVING eliminates all groups, no rows are returned - not 0 or NULL, but literally no result rows. This is different from returning a count of 0.

Multiple choice technology databases
  1. Error

  2. 69

  3. 1

  4. None

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Oracle, when you GROUP BY ROWNUM, it groups by the rownum values. With 100 rows, you get rownum values 1 through 100. The HAVING clause filters to show only the group where rownum equals 69, so it returns a single row with value 69. ROWNUM is a pseudocolumn assigned as rows are retrieved.

Multiple choice technology databases
  1. A

  2. B

  3. C

  4. None

Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

All three DELETE statements are syntactically valid in Oracle. 'DELETE FROM emp;' is the standard syntax. 'DELETE emp;' is a valid shorthand (FROM is optional). 'DELETE FROM emp WHERE 1=1;' is valid but the WHERE clause is redundant since 1=1 is always true. All three would delete all 10 rows successfully.

Multiple choice technology databases
  1. It throws error

  2. it will give 8th row

  3. no rows will get displayed

  4. None

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Oracle, ROWNUM is assigned to rows as they are retrieved, starting from 1. A query like 'WHERE ROWNUM=8' tries to find the 8th row, but ROWNUM is assigned incrementally. By the time any row could potentially be the 8th row, ROWNUM values 1-7 haven't been satisfied, so the condition never matches. The query returns no rows.

Multiple choice technology databases
  1. 0

  2. 1

  3. 2

  4. Any Number

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Unconnected lookup transformations in Informatica can return only one row per lookup operation. This is a fundamental limitation - when you configure an unconnected lookup, it returns the first matching row based on the lookup condition. If multiple rows match, only one is returned. Connected lookups differ as they process data row-by-row within the data flow.

Multiple choice technology databases
  1. Joiner

  2. Lookup

  3. Source Qualifier

  4. All

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Lookup transformation is used to check if a record exists in the target table. It queries a cached version of the target table and returns matching rows based on the lookup condition. This is commonly used for incremental loading (checking for duplicates before insert) or slowly changing dimensions (determining if a row exists before update). Joiner combines two sources in the pipeline, and Source Qualifier operates at the source database level.

Multiple choice technology databases
  1. Filter

  2. Router

  3. Lookup

  4. Expression

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Lookup transformation provides the SQL Override option, allowing you to customize the default query generated by Informatica. With SQL Override, you can add filters, modify the SELECT statement, or change the lookup condition SQL. This is useful for performance tuning or implementing complex lookup logic. Filter and Router use filter conditions (not SQL), and Expression uses expression logic - none have SQL Override capability.

Multiple choice technology mainframe
  1. 66

  2. 77

  3. 88

  4. 90

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In COBOL, level 66 is specifically reserved for the RENAMES clause, which regroups previously defined data items. Level 77 is used for independent elementary items, level 88 is for condition names, and level 90 is not a standard level number.

Multiple choice technology mainframe
  1. 66

  2. 77

  3. 88

  4. 90

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

COBOL uses level numbers to define data structure, and level 66 is specifically designated for the RENAMES clause. This clause allows you to group existing data items under an alternative name, providing a way to treat a subset of data as a single logical unit without redefining the underlying data structure.

Multiple choice technology
  1. Group By

  2. Is Null

  3. MAX

  4. All of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

MAX is a valid aggregate function that returns the maximum value in a group. Group By is not a function but a clause that defines how data is grouped. Is Null is a conditional function, not an aggregate function. Other aggregate functions include SUM, COUNT, AVG, MIN, etc.

Multiple choice technology
  1. Random Column Propogation

  2. Remove Column Propogate

  3. Runtime Column Propogation

  4. Real-time Column Propogation

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

RCP in Datastage stands for Runtime Column Propagation. This feature automatically propagates column metadata at runtime without needing to define all columns in schema. The other options (Random, Remove, Real-time) are incorrect.

Multiple choice technology databases
  1. Normalization

  2. Data Integrity

  3. Materialized Views

  4. None of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

ON UPDATE CASCADE is a referential integrity constraint that automatically updates dependent rows when a referenced primary key is updated. This ensures data consistency across related tables, preventing orphaned records and maintaining the integrity of relationships. Options A and C describe different database concepts (normalization and materialized views).

Multiple choice technology databases
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

When a NULL value appears in a NOT IN subquery or list, the entire condition evaluates to UNKNOWN for all rows because comparing any value to NULL (except with IS NULL) returns UNKNOWN, which falsifies the AND condition. This causes the query to return zero rows, not any rows as the statement suggests.