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

Multiple choice technology databases
  1. True

  2. False

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

PL/SQL automatically raises NO_DATA_FOUND exception when a SELECT INTO statement returns no rows. This is a predefined exception that triggers when a single-row query fails to find any matching data. Unlike explicit error checking, this built-in mechanism handles empty result sets gracefully.

Multiple choice technology databases
  1. True

  2. False

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

In PL/SQL, exceptions have scope similar to variables. You can declare an exception with the same name in two different blocks (nested or separate). The exception declared in the inner block will hide the one in the outer block, or they will simply exist independently in their respective scopes.

Multiple choice technology databases
  1. ISNULL(@variable,'5')

  2. NULLIF(@variable,'5')

  3. COALESCE(@variable,'5')

  4. NONNULL(@variable,'5')

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

ISNULL(@variable,'5') returns '5' when @variable is NULL, otherwise returns @variable itself. COALESCE(@variable,'5') does the same by returning the first non-NULL value from its arguments. NULLIF returns NULL if two values are equal - the opposite behavior needed here, and NONNULL is not a valid SQL function.

Multiple choice technology databases
  1. ROW_NUMBER()

  2. RANK()

  3. DENSE_RANK()

  4. NTILE(integer_expression)

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

DENSE_RANK() assigns consecutive ranks (1,2,2,2,3) without gaps after tied values, making it ideal for the requested pattern. ROW_NUMBER() always produces unique sequential numbers (1,2,3,4,5), while RANK() leaves gaps after ties (1,2,2,2,5). NTILE() divides rows into specified number of groups, producing a different pattern entirely.

Multiple choice technology programming languages
  1. Group Left report

  2. Form Like report

  3. Matrix Report

  4. Group above report

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

A Group Left report is a specific layout style where the master (grouping) column is placed to the left of the detail columns. This prevents the master value from repeating for every row of detail data, creating a clean, hierarchical view of the information.

Multiple choice technology programming languages
  1. A matrix object merely defines a relationship between two repeating frames

  2. A cursor is static

  3. A non-linkable query is a detail query that contains column objects that prevent the query from being linked to via a column-to-column link

  4. None of the above

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

The statement 'A cursor is static' is false - cursors can be dynamic depending on the database and configuration. Matrix objects do define relationships between repeating frames, and non-linkable queries contain columns preventing column-to-column linking. Therefore B is NOT true.

Multiple choice technology
  1. Function Name, <package_name>.<procedure_name>

  2. Display Name, <package_name>.<procedure_name>

  3. Display Name, <function_name>

  4. Function Name, <package_name>.<function_name>

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

In the Function window, you specify the PL/SQL function using the format . in the Function Name field. This fully qualified name identifies the stored procedure within its package. The Display Name is just for human-readable labels, not the actual function specification.

Multiple choice technology
  1. True

  2. False

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

The Oracle Workflow Engine passes four standard parameters (item type, item key, activity ID, and command mode) to stored procedures called for function activities. The procedure can return a result status that the engine uses to determine workflow progression. This parameter passing is part of the standard PL/SQL API for workflow functions.

Multiple choice technology
  1. Call Section and SQL

  2. Do Select and SQL

  3. Call Section and PeopleCode

  4. PeopleCode and Do Select

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

In PeopleSoft Application Engine, Call Section and SQL actions cannot coexist in the same step because they represent different execution paradigms - Call Section transfers control to another section, while SQL executes database statements directly. Do Select and PeopleCode can both be used in the same step with Call Section or SQL.

Multiple choice technology databases
  1. GROUP BY, HAVING, WHERE

  2. HAVING, WHERE, GROUP BY

  3. GROUP BY, WHERE, HAVING

  4. WHERE, GROUP BY, HAVING

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

The WHERE clause filters individual rows before grouping, then GROUP BY aggregates those rows into groups, and finally HAVING filters the aggregated groups based on group-level conditions. This order ensures efficient query execution.

Multiple choice technology databases
  1. Both the INSERTs and the UPDATE fails.

  2. The INSERTs work, but the UPDATE fails

  3. Only the first INSERT works.

  4. Only the second INSERT works

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

The first INSERT succeeds because no rows exist. The second INSERT fails because it violates the Unique Primary Index on column A - row (1,2) already exists with A=1. The UPDATE would affect 0 rows since the second INSERT failed.