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. WHERE clause

  2. GROUP BY clause

  3. GROUP functions

  4. DISTINCT keyword

  5. FROM clause

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

A view is not deletable if its query contains aggregate functions, GROUP BY clauses, or the DISTINCT keyword, as the system cannot map the deletion to specific source table rows. A view must have a FROM clause and can optionally have a WHERE clause without affecting delete support.

Multiple choice technology databases
  1. select count(*) from orders;

  2. select count(1) from orders;

  3. select count(3) from orders;

  4. select count(5) from orders;

Reveal answer Fill a bubble to check yourself
B Correct answer
Multiple choice technology web technology
  1. True

  2. False

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

Indexes significantly improve SELECT query performance by providing fast lookup paths. However, they impose overhead on DML operations (INSERT, UPDATE, DELETE) because the index must be updated alongside the table data. This is a fundamental trade-off in database design - faster reads come at the cost of slower writes.

Multiple choice technology databases
  1. DECLARE

  2. BEGIN

  3. EXCEPTION

  4. END

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

In PL/SQL block structure, only the execution section (BEGIN) and its terminator (END) are mandatory. The declaration section (DECLARE) is optional and only needed when declaring variables, cursors, or exceptions. The exception handling section (EXCEPTION) is also optional.

Multiple choice technology databases
  1. Cursors

  2. Cursor For Loop

  3. Simple Loop

  4. Exit Loop

  5. Numeric For Loop

  6. While Loop

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

PL/SQL iterative control constructs include Cursor For Loop (iterates over cursor rows), Simple Loop (basic LOOP with EXIT), Numeric For Loop (iterates over number range), and While Loop (condition-based iteration). Cursors themselves aren't loops, and Exit Loop isn't a standalone construct.

Multiple choice technology databases
  1. Cursor For Loop

  2. Numeric For Loop

  3. While Loop

  4. Simple Loop

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

Simple Loop is called an infinite loop because it has no built-in termination condition. It continues indefinitely until explicitly exited using an EXIT or EXIT WHEN statement. Unlike For Loops (with counter limits) or While Loops (with conditions), Simple Loop relies entirely on manual exit logic.

Multiple choice technology databases
  1. All INSERT statements

  2. All DELETE statements

  3. All UPDATE statements

  4. Single row SELECT statements

  5. Multiple row SELECT statements

  6. Zero row SELECT statements

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

Implicit cursors are automatically created by PL/SQL for all single-row DML operations (INSERT, UPDATE, DELETE) and single-row SELECT...INTO statements. Multi-row SELECT statements require explicit cursors with loops to process multiple rows.

Multiple choice technology databases
  1. %FOUND

  2. %NOTFOUND

  3. %ROWCOUNT

  4. %ISOPEN

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

The %ROWCOUNT attribute returns the number of rows fetched so far by an open cursor or affected by DML statements. In contrast, %FOUND and %NOTFOUND are boolean attributes indicating whether a row was fetched, and %ISOPEN returns a boolean indicating whether the cursor is open or closed.

Multiple choice technology databases
  1. %FOUND

  2. %NOTFOUND

  3. %ROWCOUNT

  4. %ISOPEN

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

%NOTFOUND evaluates to TRUE when a FETCH operation fails to return a row (no more rows), and FALSE when at least one row is successfully returned. This attribute is commonly used to check if a cursor has exhausted its rows after a fetch operation. %FOUND does the opposite (TRUE when a row is found).

Multiple choice technology databases
  1. 'asi'

  2. 'isa'

  3. 'le '

  4. 'acl'

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

SUBSTR('Oracle Basics', -5, 3) starts 5 characters from the end, giving 'sics' starting from position -5, then extracts 3 characters: 'asi'. Negative positions count from the string's end. So position -5 is 's', -4 is 'i', -3 is 'c', -2 is 's', -1 is the last character. Starting at -5, three characters gives 'asi'.