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. candidate key

  2. surrogate key

  3. prerrogate key

  4. identity key

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

A surrogate key is an artificial identifier used as a primary key when no natural primary key exists or when the natural key is too complex. It's typically a system-generated unique number for each row, serving as a substitute for natural keys.

Multiple choice technology databases
  1. True

  2. False

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

The anonymous PL/SQL block shown is invalid because it lacks an executable section. Even though it has the DECLARE and BEGIN/END structure, there are no statements between BEGIN and END. Oracle requires at least one executable statement (often NULL;) in the execution block. The empty execution section makes this a syntax error.

Multiple choice technology databases
  1. All matched columns returns NULLS.

  2. All unmatched columns returns NULLS.

  3. All matched and unmatched columns returns NULLS.

  4. Cant say

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

In an outer join operation, columns from the non-preserved side (the table that may not have matching rows) return NULL for unmatched rows. Matched columns from both sides return their actual values, not NULL. Option A is incorrect because matched columns don't return NULL - only the unmatched columns from the non-preserved table do.

Multiple choice technology databases
  1. Functions

  2. Package body

  3. Triggers

  4. Cursor

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

The Oracle data dictionary view USER_SOURCE stores the source code for stored PL/SQL objects including Functions, Package bodies, Procedures, and Triggers. Cursors are not stored objects - they are declared within PL/SQL blocks and are not stored in USER_SOURCE. The question tests understanding of which code objects have their source persisted in the data dictionary.

Multiple choice technology web technology
  1. Prepared statement is a precomplied SQL statement

  2. Prepared statement is a complied SQL statement

  3. Both of above

  4. None of the above

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

A Prepared Statement in JDBC is a precompiled SQL statement. Precompilation improves execution performance for repeated queries and provides strong protection against SQL injection.

Multiple choice technology mainframe
  1. LOAD MODE

  2. INSERT MODE

  3. UPDATE MODE

  4. MODIFY MODE

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

In DL/I, INSERT operations can be performed in different modes. LOAD mode is used for bulk initial data loading, while UPDATE mode allows inserting records with update capabilities. Both LOAD MODE and UPDATE MODE are valid modes for INSERT operations in DL/I.

Multiple choice technology databases
  1. drop foreign keys

  2. cascade constraints

  3. this is not possible in oracle

  4. clear references

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

In Oracle SQL, dropping a parent table referenced by foreign keys requires the CASCADE CONSTRAINTS clause to automatically drop the referencing foreign key constraints on child tables.