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
  1. Get_group_row_count System Variables

  2. Get_group_col_count System Variables

  3. Get_row_count System Variables

  4. Get_col_count System Variables

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

The built-in system variable Get_group_row_count in Oracle Reports specifically returns the number of rows in a group. This is used for conditional logic, calculations, and formatting that depends on group size.

Multiple choice technology platforms and products
  1. Primary Key Foreign Key Join

  2. Primary Key Candidate Key Join

  3. Candidate Key Foreign KeyJoin

  4. None of the above

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

A complex join in OBI EE is defined using a logical SQL expression in a WHERE clause (using AND, OR, CASE, etc.) rather than simple key-based relationships. It's not based on PK-FK, PK-CK, or CK-FK relationships alone - those describe simple foreign key joins.

Multiple choice technology mainframe
  1. True

  2. False

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

To answer this question, the user needs to know what the SEARCH ALL operation does and if it requires sorted tables.

The SEARCH ALL operation is used to find a specific record in a table that matches a given key value. It starts searching from the beginning of the table and stops when it finds the first matching record. If the table is not sorted, the search operation will have to check every record in the table, which can be slow and inefficient.

Therefore, the correct answer is:

The Answer is: A. True.

SEARCH ALL can only be applied to sorted tables for efficient search operations.

Multiple choice technology databases
  1. Cursor

  2. Varchar2

  3. PL/SQL table

  4. Table of records

  5. Record

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

For bulk data operations in PL/SQL, a table of records (declared as TYPE t_tab IS TABLE OF table_name%ROWTYPE) is the most efficient mechanism. It allows storing entire rows from a table in a PL/SQL collection variable. A cursor only points to rows, varchar2 stores single values, a record holds one row, and a PL/SQL table (index-by table) is less efficient than a table of records for bulk operations.

Multiple choice technology databases
  1. 12

  2. 4

  3. 2

  4. Unlimited

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

Oracle allows up to 12 distinct triggers per table: 4 timing levels (BEFORE/AFTER) × 2 events (INSERT/UPDATE/DELETE) × 2 levels (statement/row) for UPDATE, plus INSERT and DELETE at row and statement levels. This gives INSERT (2), UPDATE (4), DELETE (2), and 4 more variations totaling 12.

Multiple choice technology databases
  1. Truncate

  2. Merge

  3. Revoke

  4. Grant

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

TRUNCATE is a DDL (Data Definition Language) operation because it removes all rows and resets storage, performing an implicit commit that cannot be rolled back. MERGE is DML (combines INSERT/UPDATE/DELETE). REVOKE and GRANT are DCL (Data Control Language) statements for permissions.

Multiple choice technology databases
  1. select distinct * from T1

  2. select C1 from T1 order by C2

  3. select distinct C1 from T1

  4. select 12*14 from T1

  5. select C1 AS 'column1",C1 AS 'column2',C2 AS 'column1' from T1.

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

Option B is incorrect because it uses ORDER BY C2 without C2 being in the SELECT list, which is invalid Oracle SQL. The other options are valid: DISTINCT can be used with * or specific columns, arithmetic expressions in SELECT are allowed, and column aliases can be repeated though it's poor practice.

Multiple choice technology databases
  1. Truncate

  2. Merge

  3. Revoke

  4. Grant

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

MERGE is a DML (Data Manipulation Language) statement that combines INSERT and UPDATE operations based on a condition. TRUNCATE is DDL (removes data, resets storage). REVOKE and GRANT are DCL (Data Control Language) for managing permissions.

Multiple choice technology databases
  1. floor

  2. sum

  3. variance

  4. stddev

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

Functions like sum, variance, and stddev are aggregate or group functions that operate on sets of rows to return a single summary value. Conversely, floor is a single-row numeric scalar function, making it incorrect as a group function.

Multiple choice technology databases
  1. True

  2. False

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

In Oracle, readers never block writers and writers never block readers due to multiversion read consistency. When rows are locked by DML operations, other sessions can still query those rows using the before-image from undo segments. This prevents SELECT statements from waiting for row locks to be released.