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. SQL%ROWCOUNT, SQL%ISFOUND,SQL%NOTFOUND,SQL%ISOPEN

  2. SQL%ROWCOUNT, SQL%FOUND,SQL%NOTFOUND,SQL%OPEN

  3. SQL%ROWCOUNT, SQL%FOUND,SQL%NOTFOUND,SQL%ISOPEN

  4. All of the above

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

The correct SQL cursor attributes in PL/SQL are: SQL%ROWCOUNT (number of rows affected), SQL%FOUND (boolean, true if at least one row affected), SQL%NOTFOUND (boolean, true if no rows affected), and SQL%ISOPEN (boolean, always false for implicit cursors). Option B incorrectly uses SQL%OPEN, and Option A incorrectly uses SQL%ISFOUND.

Multiple choice technology web technology
  1. True

  2. False

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

Decision tables allow individual condition cells to be disabled for specific rows, meaning those conditions will not be evaluated for those particular rule rows. This provides flexibility in rule logic by allowing certain conditions to be skipped without removing the entire condition column.

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 the DECLARE and EXCEPTION sections are optional. Every PL/SQL block must have BEGIN and END keywords to define the executable section. The DECLARE section (for declarations) and EXCEPTION section (for error handlers) can be omitted if not needed.

Multiple choice technology databases
  1. To duplicate the functionality of other triggers.

  2. To replicate built-in constraints in the Oracle server such as primary key and foreign key.

  3. To guarantee that when a specific operation is performed, related actions are performed.

  4. For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement.

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

Database triggers are designed for centralized operations and ensuring related actions occur. They should not duplicate built-in constraints or other triggers. Option C describes enforcing related actions (e.g., audit logging on update). Option D describes global operations firing regardless of user.

Multiple choice technology performance
  1. a. Parse

  2. b. Fetch

  3. c. Retrieve

  4. d. Bind

  5. e. Execute

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

SQL execution follows these phases: Parse (syntax/semantic validation), Bind (variable binding), Execute (query execution), and Fetch (returning results to client). 'Retrieve' is not typically listed as a separate step in standard SQL execution phases.

Multiple choice technology performance
  1. Less than 10ms

  2. 100ms

  3. 150ms

  4. 50ms

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

In OLTP (Online Transaction Processing) applications, individual SQL statements should execute very quickly - typically less than 10 milliseconds - to maintain high transaction throughput and responsiveness. Values of 50ms, 100ms, or 150ms would be considered too slow for OLTP workloads.

Multiple choice technology performance
  1. True

  2. False

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

Using hints in SQL statements is generally not advisable because they hard-code optimization assumptions that may become outdated as data distribution changes. Hints should only be used as a last resort when the optimizer consistently makes poor choices and other tuning methods have been exhausted.

Multiple choice technology performance
  1. Explain Plan

  2. Trace

  3. Parse

  4. Bind

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

Explain Plan and Trace are the correct first steps for SQL tuning. Explain Plan shows the execution plan and access paths. Trace provides detailed execution statistics. Parse and Bind are execution phases, not tuning tools - they describe how SQL is processed, not how to analyze or improve it.

Multiple choice technology performance
  1. True

  2. False

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

Bind variables (parameters) should always be used in SQL statements instead of concatenating values. This prevents SQL injection attacks, improves query performance through cursor sharing, and enhances security by separating code from data.