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
-
PL/SQL program needs to be recompiled frequently.
-
/SQL program that spends most of the time executing SQL
-
PL/SQL program , which performs computation-intensive procedural operations and is recompiled rarely
-
PL/SQL program , which is called frequently with the same parameter values by multiple sessions and is recompiled rarely.
A,B
Correct answer
Explanation
Interpreted mode is useful when PL/SQL needs frequent recompilation (avoid native compilation overhead) or when the program spends most time executing SQL (interpretation overhead is negligible compared to SQL execution time). Native mode is better for computation-intensive procedural code that's compiled rarely.
-
Only local subroutins can be inlined
-
Inlining always reduces the execution time for the PL/SQL program unit
-
PLSQL_OPTIMIZE_LEVEL must be set to a value greater than or equal to 2
-
the PL/SQL programs that make use of relatively large helper subroutines are good candidates for inlining
-
A cursor variable points to the current roe in the result set of a multirow query stored in work area
-
A cursor variable is an explicitly named work area in which the results of different multirow queries can be stored.
-
A cursor variable can be used only if a query is performed and its results are processed in the same subprogram.
-
A cursor variable can be used to perform a query in one subprogram , and process results in a different sub program
-
sql and call section
-
sql and do while
-
do while and do when
-
do while and do until
A
Correct answer
Explanation
In PeopleSoft Application Engine, SQL and Call Section actions are mutually exclusive and cannot be defined within the same step to prevent database lock contention and execution ambiguity. All other listed action combinations, such as conditional do loops (Do While, Do Until, Do When), can co-exist within steps.
-
Select/Fetch
-
Reselect
-
Restart able
-
All of the above
D
Correct answer
Explanation
In PeopleSoft Application Engine, Do Select actions can be configured as Select/Fetch (to loop through a rowset), Reselect (to re-evaluate the query on each loop), or Restartable (to keep track of checkpoint state). Since all three are valid, 'All of the above' is the correct option.
C
Correct answer
Explanation
PeopleSoft Application Engine has a limitation of 99 temporary table instances that can be defined and used within a single AE program. This is a hard limit in the system architecture. Temporary tables are crucial for parallel processing and managing multi-user execution scenarios.
A
Correct answer
Explanation
In Easytrieve, when accessing DB2 tables, a cursor is required even for a single fetch operation. This is because DB2 operations in Easytrieve are cursor-based by design - the cursor declaration and use are mandatory for SQL operations, regardless of the number of rows being fetched.
-
It is a standard method to enforce information integrity
-
It is a standard method to manipulate data in databases
-
They are policies to enforce security access to database
-
Are method that allow users to authenticate
A
Correct answer
Explanation
A constraint is a rule enforced at the database level to maintain data integrity and ensure information accuracy. Constraints prevent invalid data entry (like NOT NULL prevents nulls, UNIQUE prevents duplicates, CHECK validates values). Option B is incorrect because constraints don't manipulate data - that's what DML statements do. Option C confuses constraints with security policies. Option D confuses constraints with authentication mechanisms.
-
When a field that is a primary key cannot be used a foreign key because of security policies
-
When a primary key is composed by more than field
-
When a primary key is a set of fields that are foreign keys
-
When a set of fields that are foreign keys are set as a primary key
B
Correct answer
Explanation
A superkey is a set of one or more attributes that can uniquely identify tuples in a relation. The question describes a composite primary key (one made of multiple fields) but calls it a 'superkey' - this is terminology confusion. A composite primary key IS a type of superkey, but the standard definition doesn't mention security policies or foreign keys. The question's phrasing is imprecise but option B is the closest to describing a multi-attribute key.
-
Integer
-
Binary
-
Char
-
Varchar
A
Correct answer
Explanation
Surrogate keys are typically implemented as integers (often auto-incrementing or sequence-generated) because they provide efficient storage, fast join performance, and carry no business meaning. They are not character-based like natural keys, nor binary like some system identifiers.
-
CATALOG,VALUES
-
MESSAGES,VALUES
-
CATALOG,MESSAGES,VALUES
-
CATALOG,MESSAGES
-
ALL
-
ASYMMETRIC
-
LEADING
-
TRACING
D
Correct answer
Explanation
In ESQL, ALL, ASYMMETRIC, and LEADING are reserved keywords with specific SQL meanings. TRACING is not a reserved keyword in ESQL - it can be used as an identifier name. Reserved keywords cannot be used as identifiers without quoting, while non-reserved words like TRACING have no special meaning.
A
Correct answer
Explanation
FULL JOIN (or FULL OUTER JOIN) returns all rows when there is a match in either table - it returns matched rows from both tables, plus unmatched rows from each table padded with NULLs. This differs from INNER JOIN (only matches) or LEFT/RIGHT JOIN (matches plus unmatched from one side). The statement accurately describes FULL JOIN behavior of returning rows when there's a match in at least one of the tables.
-
auto_increment
-
sequence
-
identity
-
increment
B
Correct answer
Explanation
In Oracle, auto-increment functionality is implemented using SEQUENCE objects, not the auto_increment keyword used in MySQL. A sequence generates unique numeric values that can be used for auto-incrementing primary keys through triggers or direct insertion. Option A is MySQL syntax, Option C is SQL Server/PostgreSQL syntax, and Option D is not a valid keyword in this context.