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. Only varrays must start with the subscript 1.

  2. Only varrays can be used as column types in database tables.

  3. Both associative arrays and varrays must start with the subscript 1.

  4. Both associative arrays and varrays can be used as column types in database tables.

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

Varrays must start with subscript 1 and can be stored as table columns. Associative arrays have flexible indexing (including negative or string keys) and cannot be column types: they exist only in PL/SQL memory.

Multiple choice technology databases
  1. catproc.sql

  2. utlchain.sql

  3. catchain.sql

  4. utlproc.sql

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

In Oracle databases, the utlchain.sql script creates the CHAINED_ROWS table, which stores information about chained and migrated rows. This table is used with the ANALYZE command to identify rows that are chained or migrated across multiple blocks, helping optimize database performance.

Multiple choice technology platforms and products
  1. pr4_base

  2. pc_work

  3. pc_other

  4. none of the above

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

In Pega, work classes within a class group typically map to the class group table, which defaults to pc_work. However, unless explicitly mapped otherwise, standard behavior for concrete classes not designated as part of a work pool is to fall back to the default pr4_base table.

Multiple choice technology programming languages
  1. 5

  2. 25

  3. 50

  4. 0

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

The SQRT function in SQL calculates the square root of a numeric value. The square root of 25 is 5. Since DUAL is a dummy table in Oracle database, selecting SQRT(25) from it yields a single row containing the value 5.

Multiple choice technology
  1. Yes

  2. no

  3. look up is not for filtering so it throws error

  4. when performing look up we need to write a stored procedure

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

Lookup transformations can effectively filter records by using the lookup condition - records that match the condition are returned, while non-matching records can be dropped or processed differently. This is a common filtering technique in mappings.

Multiple choice technology databases
  1. %ROWTYPE

  2. %TYPE

  3. AS_COLUMN

  4. None of the above

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

The %TYPE attribute in PL/SQL declares a variable with the same data type as a specified column in a table. %ROWTYPE declares a record type matching an entire row. AS_COLUMN doesn't exist in PL/SQL. %TYPE is useful for maintaining type compatibility without hardcoding specific types.

Multiple choice technology databases
  1. True

  2. False

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

The statement claims SQL has NO error handling facility, which is False. SQL DOES have programmed error handling: PL/SQL uses EXCEPTION blocks, T-SQL uses TRY/CATCH, MySQL uses DECLARE handlers. Modern SQL implementations support robust error handling mechanisms for data manipulation errors.

Multiple choice technology databases
  1. DELCARE and BEGIN

  2. DECALRE and EXCEPTION

  3. EXCEPTION and END

  4. BEGIN and END

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

In a PL/SQL block, only BEGIN and END are mandatory. The DECLARE section (for declarations) and EXCEPTION section (for error handling) are both optional components that can be omitted if not needed.

Multiple choice technology databases
  1. A stored procedure on the server.

  2. A block of code in a PL/SQL library.

  3. A standalone procedure on the client machine.

  4. A block of code in the body of the program unit ORDERTOTAL.

  5. A local subprogram defined within the program unit ORDERTOTAL.

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

A local subprogram within ORDERTOTAL is ideal because it's scoped only to that unit (avoiding global scope pollution) while being reusable from multiple places within ORDERTOTAL. Stored procedures or standalone code would be overly broad for this requirement.

Multiple choice technology databases
  1. Some DML,PL/SQL statements

  2. All DML,PL/SQL statements

  3. Only PL/SQL statements

  4. None of the Above

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

Oracle automatically declares implicit cursors for ALL DML statements and PL/SQL blocks. Every INSERT, UPDATE, DELETE, and SELECT operation that processes rows uses an implicit cursor, not just some of them.