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
-
Float
-
None
-
Clone
-
Copy
-
Replicate
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.
-
We can override parameters on EXEC statements and add DD statements.
-
We can override, nullify and add parameters on all statements and add DD and/or OUTPUT
-
We can add and override parameters to all statements, but can only nullify parameters
-
We can nullify, override and add parameters to all statements, but can only add DD statements.
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.
-
Removes duplicate rows from your result.
-
Selects all the rows.
-
Puts the rows in descending order.
-
None of the above
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.
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.
-
Control access to table.
-
Make data easier to use.
-
Only b
-
Both a and b
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.
-
INSERT
-
UPDATE
-
DELETE
-
All the above.
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.
-
WHERE clause
-
HAVING clause
-
Either of the above
-
None of the above
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.
-
Specified in the definition of a referential constraint.
-
A part of the definition of a table.
-
A unique key
-
None of the above
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.
-
View
-
Synonym
-
Result table
-
Alias
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.
-
WHERE
-
AND
-
IS NULL
-
BETWEEN
A
Correct answer
Explanation
WHERE is a SQL clause that introduces conditions, not a comparison operator itself. AND is a logical operator that combines conditions, IS NULL checks for null values, and BETWEEN tests range conditions - these are all valid operators or predicates used within WHERE clauses.
C
Correct answer
Explanation
Column functions (also called aggregate functions) operate on sets of values. SUM calculates the total of numeric values, AVG computes the average. Both are standard column functions in SQL.
-
INSERT
-
APPEND
-
REPLACE TRUNCATE
-
DELETE UPDATE
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.
-
INSERT : Loads rows only if the target table is empty
-
APPEND: Load rows if the target table is empty or not.
-
REPLACE: First deletes all the rows in the existing table and then, load rows.
-
TRUNCATE: First truncates the table and then load rows.
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.
-
Tables are not clustered.
-
Tables to be loaded do not have any active transactions pending.
-
Loading a parent table together with a child Table
-
Loading BFILE columns
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.
D
Correct answer
Explanation
In Sybase IQ, the Fast Projection (FP) index is the default index type automatically created for every column in a table when the table is defined. Other index types like LF, HG, and HNG must be explicitly created.