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
C
Correct answer
Explanation
SQL BETWEEN is inclusive, so BETWEEN 'A' AND 'J' includes strings starting with both 'A' and 'J'. However, lexicographic ordering means 'JAMES' > 'J' (since 'JAMES' has more characters). Only 'JOHN' falls between 'A' and 'J' because 'J' alone matches the upper bound. The result is 1 row.
A
Correct answer
Explanation
Under the SQL standard, aggregate functions (like SUM, AVG, MIN, MAX, and COUNT) ignore NULL values in their evaluation, except for COUNT(). However, the prompt contains a typographical error ('ingnored', 'SQ: 2008'), and if COUNT is counted as an aggregate function, not *all ignore NULLs. Given standard exam content, the intended answer is True, but the statement has minor errors.
-
GROUPING
-
WITH ROLL UP
-
WITH CUBE
-
WITH SUMMARY
B,C
Correct answer
Explanation
WITH ROLLUP generates subtotals and grand totals based on the grouping hierarchy. WITH CUBE generates all possible combinations of subtotals across grouping columns. GROUPING and WITH SUMMARY are not valid SQL 2008 syntax for producing totals.
-
insert
-
Delete
-
Cancel
-
Replace
A,D
Correct answer
Explanation
Processing constraints restrict which operations can be performed on orders. Insert and Replace are NOT processing constraints - they are standard operations. Delete and Cancel ARE constraint types that control when orders/lines can be removed.
-
Changes to the order sets are always respected when changing a line in the set
-
Defaulting rules can execute multiple lines
-
All updates to a sales order must pass processing constraint rules except when canceling the order line
-
Updating an order header after defaulting rules have been applied would have no effect on existing order lines.
B
Correct answer
Explanation
Using the NOT operator in SQL queries DECREASES performance. NOT prevents the database from using indexes efficiently and forces additional negation processing. Queries using NOT (or !=, NOT IN, NOT EXISTS) are slower than their positive equivalents because they require evaluating and rejecting rows rather than directly matching them.
A
Correct answer
Explanation
In SQL:2008 and most SQL standards, NULL values are ignored by all aggregate functions like COUNT, SUM, AVG, MIN, MAX, etc. COUNT(*) counts all rows including NULLs, but COUNT(column) ignores NULLs. This behavior ensures aggregate calculations don't get skewed by unknown/missing values.
-
Rounding decimal values to Integers
-
Removing special characters from a Text field
-
Defining Primary Key constraint on a Table
-
Assigning a default value to a field.
C
Correct answer
Explanation
Defining a Primary Key constraint is a database schema operation, not a data transformation. The other options (rounding decimals, removing special characters, assigning default values) are all data transformations that modify the data itself during the ETL process. Constraints are structural, not transformational.
B
Correct answer
Explanation
Keyword parameters do not support retrieving future or past date values. The system likely only provides current date-related values through these keywords, not relative date calculations or offsets.
B
Correct answer
Explanation
Keyword Parameters in Business Objects do not support date arithmetic for advance or past dates. Keyword parameters are primarily for static or runtime value substitution, not date calculations. To get advance/past dates, you would need to use specific date functions like |EZCYMFP4| or other date manipulation keywords.
A
Correct answer
Explanation
DB2 SELECT queries return result sets that must be processed row by row. Using a cursor (DECLARE, OPEN, FETCH, CLOSE) is the standard method for handling query results. This is especially important for queries embedded in application programs where the result set needs to be processed sequentially.
A
Correct answer
Explanation
@DELETE,C is a valid delete statement syntax in this system. The '@' prefix indicates a command, DELETE specifies the operation, and 'C' appears to be a valid parameter or target identifier.
-
a. Local List
-
b. Field Value
-
c. Remote List
-
d. Prompt List
B
Correct answer
Explanation
In portal property configuration, the TableEdit tab is used for specifying how list-based properties are handled. For short to medium-sized lists that change frequently, 'Field Value' is the appropriate setting as it stores values directly in the property rather than maintaining a separate list reference. Local Lists are for static, predefined options, while Remote Lists and Prompt Lists serve different purposes.
-
ORDER BY
-
FROM
-
SELECT
-
WHERE
D
Correct answer
Explanation
The WHERE clause in SQL queries is specifically designed to filter rows based on conditions, limiting which rows are returned by the SELECT statement. FROM specifies the table source, SELECT chooses columns, and ORDER BY sorts the results. Only WHERE actually limits the rows selected based on criteria.