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 mainframe
  1. 8

  2. 15

  3. 16

  4. 256

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

DB2 allows joining up to 15 tables in a single SELECT query. This limit balances query complexity with performance considerations in the DB2 optimizer. 8 tables is possible but not the maximum. 16 exceeds the limit, and 256 is far beyond practical join limits. Joining many tables requires careful indexing and query optimization.

Multiple choice technology databases
  1. True

  2. False

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

Triggers are indeed special stored procedures that automatically execute in response to certain events on a particular table or view - typically INSERT, UPDATE (modify), or DELETE operations. They're used to enforce business rules, maintain data integrity, or automate tasks without direct user intervention.

Multiple choice technology databases
  1. True

  2. False

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

The SELECT INTO statement creates a new target table and populates it with rows and columns from the source table. It's a combination of CREATE TABLE and INSERT SELECT - the new table is automatically created based on the structure of the selected data, making it useful for quick table creation and data copying.

Multiple choice technology programming languages
  1. DROP USER david all

  2. DROP USER david schema

  3. DROP USER david cascade

  4. DROP USER david cascade schema

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

The CASCADE option in DROP USER (DROP USER david CASCADE) removes the user and all objects owned by that user. Without CASCADE, the command would fail if the user owned any database objects. CASCADE ensures clean removal by automatically dropping dependent objects.

Multiple choice technology programming languages
  1. It is a session specific table.

  2. It is an invalid SQL statement.

  3. It is only available in Oracle 7

  4. It is a transaction specific table.

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

The ON COMMIT DELETE ROWS clause makes this a transaction-specific temporary table - rows are automatically deleted when the transaction commits. This differs from ON COMMIT PRESERVE ROWS (session-specific) where rows persist for the entire session. Global temporary tables with ON COMMIT DELETE ROWS are cleaned up at transaction end, not session end.

Multiple choice technology mainframe
  1. Uncomment the DCLGEN move statement & cast the package

  2. ignore the statement & cast the package

  3. ignore the statement & cast the package with Warnings

  4. Should not move the code until the DBA's move the DCLGEN

Reveal answer Fill a bubble to check yourself
C Correct answer
Multiple choice technology mainframe
  1. terminal customer table

  2. Transaction control table

  3. Tranmission control table

  4. Terminal Control table

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

TCT (Terminal Control Table) is a CICS table that defines and controls terminals in the system. It manages terminal characteristics and how CICS communicates with them.

Multiple choice technology mainframe
  1. Request control table

  2. Resource control table

  3. Request control transaction

  4. Region control table

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

RCT expands to Resource Control Table in mainframe systems. It manages and controls system resources during job execution. Request control table and Region control table are incorrect expansions - RCT specifically deals with resource management.

Multiple choice technology platforms and products
  1. True

  2. False

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

Sparse lookup is used when reference data DOES change frequently - it performs a direct database lookup each time rather than caching, which is expensive but necessary for dynamic data. For stable/infrequently changing data, you would use a cached lookup (not sparse) for better performance.

Multiple choice technology mainframe
  1. 0

  2. 1

  3. 2

  4. 3

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

The query reads records with SUPER-ID-NAME-AGE starting from '1235' through '3457'. Records with IDs 2345 and 3456 fall within this range (1235 < 2345 < 3457 and 1235 < 3456 < 3457). Record 1234 is below the range, and records 4567 and 5678 are above it. Therefore, 2 records are displayed.

Multiple choice technology mainframe
  1. 0

  2. 1

  3. 2

  4. 3

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

The FIND uses IDENT-ID EQ '1234', which is a non-unique descriptor (appears in 2 records: AAAA and ABCD). FIND on a non-unique descriptor returns all matching records in ISN (Internal Sequence Number) order, so 2 records are displayed.

Multiple choice technology mainframe
  1. 0

  2. 1

  3. 2

  4. 3

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

SUPER-ID-NAME-AGE comprises IDENT-ID + IDENT-NAME + IDENT-AGE concatenated. The FIND looks for records where this superdescriptor EXACTLY equals '1234'. However, no record has this value - the superdescriptor values are much longer (e.g., '1234AAAA23'). So 0 records match.

Multiple choice technology mainframe
  1. 0

  2. 1

  3. 2

  4. 3

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

SUPER-ID-NAME-AGE comprises IDENT-ID, IDENT-NAME, IDENT-AGE in that order. The READ range '1235' THRU '3457' matches 2 records: 2345 BBBB 13 (starts with 2345) and 3456 CCCC 25 (starts with 3456). Record 1234 AAAA 23 is excluded (1234 < 1235), and 4567 DDDD 15 is excluded (4567 > 3457).