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 platforms and products
  1. Float

  2. None

  3. Clone

  4. Copy

  5. Replicate

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

In relationship revision options within Matrix database systems, 'Float' allows relationships to exist without strict enforcement, 'None' indicates no revision control is applied, and 'Replicate' creates copies of related data. Clone and Copy are not standard revision options in this context - they may describe data operations but not relationship revision behaviors.

Multiple choice technology mainframe
  1. We can override parameters on EXEC statements and add DD statements.

  2. We can override, nullify and add parameters on all statements and add DD and/or OUTPUT

  3. We can add and override parameters to all statements, but can only nullify parameters

  4. We can nullify, override and add parameters to all statements, but can only add DD statements.

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

When calling JCL procedures, you have extensive modification capabilities. Option B is most complete because procedures allow overriding, nullifying, or adding parameters on all statement types (JOB, EXEC, DD), plus adding new DD and OUTPUT statements. Options A, C, and D are incomplete because they don't capture the full range of modification capabilities available when calling procedures.

Multiple choice technology mainframe
  1. Removes duplicate rows from your result.

  2. Selects all the rows.

  3. Puts the rows in descending order.

  4. None of the above

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

DISTINCT removes duplicate rows from result sets, returning only unique rows. It does not select all rows, affect ordering, or perform filtering - it purely eliminates duplicates based on selected columns.

Multiple choice technology mainframe
  1. True

  2. False

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

UNION can be used with outer joins because UNION combines result sets from multiple queries, and outer joins return matched plus unmatched rows. UNION ALL preserves duplicates while UNION eliminates them, but both are compatible with join operations.

Multiple choice technology mainframe
  1. Control access to table.

  2. Make data easier to use.

  3. Only b

  4. Both a and b

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

Views serve two key purposes: they can restrict data access by showing only selected columns or rows (security/control), and they can simplify complex queries by presenting pre-joined or calculated data (usability). Both functions are standard use cases.

Multiple choice technology mainframe
  1. INSERT

  2. UPDATE

  3. DELETE

  4. All the above.

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

DB2 provides three main DML (Data Manipulation Language) statements for modifying data: INSERT adds new rows, UPDATE modifies existing rows, and DELETE removes rows. All three operations change the database content.

Multiple choice technology mainframe
  1. WHERE clause

  2. HAVING clause

  3. Either of the above

  4. None of the above

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

In SQL, a subquery (nested query) can be placed in several clauses, including the WHERE clause to filter rows and the HAVING clause to filter groups. Since both options are valid, 'Either of the above' is correct.

Multiple choice technology web technology
  1. Specified in the definition of a referential constraint.

  2. A part of the definition of a table.

  3. A unique key

  4. None of the above

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

A foreign key is a key specified in the definition of a referential constraint to link two tables. It is not necessarily a unique key on its own, and it is part of the constraint definition rather than a basic table column definition.

Multiple choice technology mainframe
  1. View

  2. Synonym

  3. Result table

  4. Alias

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

When SQL retrieves data, the output is called a result table - a temporary set of rows matching the query criteria. A view is a stored query definition, a synonym is an alternate name for an object, and an alias is an alternate name for a table - none of these are the retrieved data itself.

Multiple choice technology databases
  1. INSERT

  2. APPEND

  3. REPLACE TRUNCATE

  4. DELETE UPDATE

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

SQL*Loader supports INSERT (into empty table), APPEND (to existing table), and REPLACE (which can be combined with TRUNCATE to clear table first). DELETE and UPDATE are not valid SQL*Loader loading methods - SQL*Loader is designed for data loading, not DML operations.

Multiple choice technology databases
  1. INSERT : Loads rows only if the target table is empty

  2. APPEND: Load rows if the target table is empty or not.

  3. REPLACE: First deletes all the rows in the existing table and then, load rows.

  4. TRUNCATE: First truncates the table and then load rows.

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

This multiple-choice multi-select question correctly defines SQL*Loader options: INSERT requires an empty table, APPEND adds to existing data, REPLACE deletes existing rows, and TRUNCATE truncates the table.

Multiple choice technology databases
  1. Tables are not clustered.

  2. Tables to be loaded do not have any active transactions pending.

  3. Loading a parent table together with a child Table

  4. Loading BFILE columns

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

Direct path load requirements include: non-clustered tables, no active transactions, and special handling for referential constraints (loading parent and child together). BFILE columns are also supported in direct path loads. All conditions listed are valid.