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
-
A matrix object merely defines a relationship between two repeating frames
-
A cursor is static
-
A non-linkable query is a detail query that contains column objects that prevent the query from being linked to via a column-to-column link
-
None of the above
B
Correct answer
Explanation
The statement 'A cursor is static' is false - cursors can be dynamic depending on the database and configuration. Matrix objects do define relationships between repeating frames, and non-linkable queries contain columns preventing column-to-column linking. Therefore B is NOT true.
-
Function Name, <package_name>.<procedure_name>
-
Display Name, <package_name>.<procedure_name>
-
Display Name, <function_name>
-
Function Name, <package_name>.<function_name>
A
Correct answer
Explanation
In the Function window, you specify the PL/SQL function using the format . in the Function Name field. This fully qualified name identifies the stored procedure within its package. The Display Name is just for human-readable labels, not the actual function specification.
A
Correct answer
Explanation
The Oracle Workflow Engine passes four standard parameters (item type, item key, activity ID, and command mode) to stored procedures called for function activities. The procedure can return a result status that the engine uses to determine workflow progression. This parameter passing is part of the standard PL/SQL API for workflow functions.
-
Call Section and SQL
-
Do Select and SQL
-
Call Section and PeopleCode
-
PeopleCode and Do Select
A
Correct answer
Explanation
In PeopleSoft Application Engine, Call Section and SQL actions cannot coexist in the same step because they represent different execution paradigms - Call Section transfers control to another section, while SQL executes database statements directly. Do Select and PeopleCode can both be used in the same step with Call Section or SQL.
-
DUPLICATE (n)
-
REMOVDUP (n)
-
FIRSTDUP(n)
-
NONE OF THE ABOVE
C
Correct answer
Explanation
FIRSTDUP(n) is the correct DFSORT/ICETOOL operator that selects n records after removing duplicates. DUPLICATE(n) is not a valid operator name, REMOVDUP doesn't exist in this syntax, and NONE is incorrect.
-
GROUP BY, HAVING, WHERE
-
HAVING, WHERE, GROUP BY
-
GROUP BY, WHERE, HAVING
-
WHERE, GROUP BY, HAVING
D
Correct answer
Explanation
The WHERE clause filters individual rows before grouping, then GROUP BY aggregates those rows into groups, and finally HAVING filters the aggregated groups based on group-level conditions. This order ensures efficient query execution.
-
Both the INSERTs and the UPDATE fails.
-
The INSERTs work, but the UPDATE fails
-
Only the first INSERT works.
-
Only the second INSERT works
C
Correct answer
Explanation
The first INSERT succeeds because no rows exist. The second INSERT fails because it violates the Unique Primary Index on column A - row (1,2) already exists with A=1. The UPDATE would affect 0 rows since the second INSERT failed.
-
If the Join is a SELF JOIN.
-
Only if the WHERE clause is not used.
-
If the keyword INNER is specified.
-
all the time.
A
Correct answer
Explanation
SUBSTRING('RALPH JOHNSON' FROM 6 FOR 5) extracts 5 characters starting at position 6, which yields ' JOHN'. The INDEX function then searches for 'OHN' within ' JOHN'. 'OHN' starts at the 3rd character of ' JOHN' (space is 1, J is 2, O is 3), returning 3.
-
Minus
-
Except
-
Intersect
-
Union
-
Return Top 3 Row in the Retailer Table
-
Return Error
-
Return No Record
-
Return all Records from Retailer Table
B
Correct answer
Explanation
The subquery 'select top 3 Rtrid from retailer' returns multiple rows, but the WHERE clause uses '=' which expects a single value. Comparing a column to multiple rows with '=' causes an error - you should use 'IN' instead for multiple values.
-
Return Top 3 Row in the Retailer Table
-
Return Error
-
Return No Record
-
Return all Records from Retailer Table
-
Abs is not a recognized function name
-
-20
-
20
-
None
C
Correct answer
Explanation
The expression 25-45 evaluates to -20, and the ABS() function returns the absolute value, which is 20. ABS is a valid SQL Server function that returns the magnitude of a number.
-
All the Above
-
i) and ii)
-
i), ii) and iii)
-
None
A
Correct answer
Explanation
SQL supports various types of joins to combine rows from two or more tables. Inner Join, Left Outer Join, Cross Join, and Self Join are all standard, valid join types available in SQL, making 'All the Above' the correct choice.