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 programming languages
  1. Resets the values

  2. Copies the values of mathcing column names

  3. Copies and rests the value specified

  4. None of the above

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

Move by name copies the values from fields with matching column names in the source structure to the target structure. It does not reset values or perform copy-then-reset operations.

Multiple choice technology databases
  1. Implicit

  2. Explicit

  3. inner join

  4. Outer join

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

The record-required parameter is specific to Explicit join type in Ab Initio. It specifies how many input flows must contribute a record for output to be generated. This parameter doesn't apply to Implicit joins where the join conditions define the relationship.

Multiple choice technology databases
  1. Writes the record to the reject port

  2. Writes a descriptive error message to the error port

  3. Discards the information if you do not connect flows to the reject or error ports

  4. Processes all records

Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

When input_select returns NULL in a Normalize component, three actions occur: the record goes to the reject port, an error message is written to the error port, and if these ports aren't connected, the record is silently discarded. This is the standard error handling behavior.

Multiple choice technology
  1. True

  2. False

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

True - query filters can be made optional in reporting tools. Optional filters allow reports to run even if the user doesn't provide a value for that filter, providing flexibility in report execution.

Multiple choice technology platforms and products
  1. Formula

  2. Compound Attributes

  3. Table Editor

  4. SQL Client

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

In Asset Control, custom validation rules for incoming feed data are extended by creating and applying Formulas. While features like Compound Attributes define data relationships and the Table Editor allows manual data modifications, only Formulas are used to programmatically evaluate and enforce validation constraints.

Multiple choice technology databases
  1. subquery results

  2. results of a query having the SYSDATE function

  3. results of a query having the GROUP BY clause

  4. results of a query having the DATE data type in the WHERE clause

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

Subquery results cannot be stored in the query result cache because they represent intermediate results, making option A correct. Queries with SYSDATE function cannot be cached since SYSDATE returns different values on each execution, making option B correct. GROUP BY results and static DATE conditions in WHERE clauses can be cached, so options C and D are incorrect.

Multiple choice technology databases
  1. Use subprograms as pasrt of packages instead of stand-alone parameters

  2. Use dynamic SQL’s constructed using concatenation of input values.

  3. Use bind arguments

  4. Usage of the NOT NULL constraint in PL/SQL code can degrade performance

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

Using bind arguments is a primary defense against SQL injection because it separates SQL logic from data values, preventing malicious input from altering SQL structure. Option A is incorrect because package subprograms alone don't prevent injection. Option B is incorrect because concatenation actually increases vulnerability. Option D about NOT NULL constraint is irrelevant to SQL injection security.

Multiple choice technology databases
  1. REF CURSOR types cannot be defined inside a package

  2. SYS_ REFCURSOR can be used to declare cursor variables in stored procedures and functions

  3. A REF CURSOR return type can be declared using %TYPE or %ROWTYPE or a user-defined record.

  4. Only a weak REF CURSOR type can be used as a formal parameter of a stored procedure or function.

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

SYS_REFCURSOR is a pre-defined weak REF CURSOR type that can be used to declare cursor variables in stored procedures and functions, making option B correct. REF CURSOR return types can be declared using %TYPE, %ROWTYPE, or user-defined records, making option C correct. Option A is incorrect because REF CURSOR types can be defined inside packages. Option D is incorrect because both weak and strong REF CURSOR types can be used as formal parameters.

Multiple choice technology databases
  1. It must be part of a package.

  2. It must be a pipelined table function.

  3. It must not be defined in an anonymous block.

  4. It must have at least one OUT or IN OUT parameter.

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

For a PL/SQL function to be cached, it must not be defined in an anonymous block (which are transient), making option C correct. It must have at least one OUT or IN OUT parameter to support result caching, making option D correct. Option A is incorrect because standalone functions can also be cached. Option B is incorrect because pipelined table functions are not eligible for result caching.

Multiple choice technology platforms and products
  1. a. FROM

  2. b. WHERE

  3. c. GET

  4. d. SELECT

  5. e. IMPORT

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

In SQL, the WHERE clause specifies filtering criteria to restrict which rows are returned. In PeopleSoft Query, when you add criteria/conditions to filter data, these translate directly to WHERE clause conditions in the generated SQL. SELECT specifies columns, FROM specifies tables, GET and IMPORT are not SQL clauses.

Multiple choice technology platforms and products
  1. a.SearchSave

  2. b.SavePreChange

  3. c.SavePostChange

  4. d.SaveEdit

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

SavePostChange is the PeopleCode event that fires immediately after the Component Processor has successfully updated the database. SaveEdit and SavePreChange fire before the database updates are committed, and SearchSave is triggered during the search process before the component is loaded.

Multiple choice technology platforms and products
  1. a. FROM

  2. b. WHERE

  3. c. GET

  4. d. SELECT

  5. e. IMPORT

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

In PeopleSoft Query, when you specify criteria to filter records, it translates to the WHERE clause in SQL. The WHERE clause filters rows based on conditions, which is exactly what query criteria do. SELECT specifies columns, FROM specifies tables, and WHERE is for filtering conditions.

Multiple choice technology platforms and products
  1. a.SearchSave

  2. b.SavePreChange

  3. c.SavePostChange

  4. d.SaveEdit

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

After the Component Processor updates the database successfully, it fires the SavePostChange PeopleCode event. SavePreChange fires before the update, SaveEdit is for validation, and SearchSave is for saving search dialog box data. SavePostChange is used for post-processing after data commit.

Multiple choice technology databases
  1. select min(field4) as Min,Max(field4) as Max,(select Max(field4) from table1 where field4 not in(Select Min(field4) from table1)) as 2nmax from table1

  2. select min(field4) as Min,Max(field4) as Max,(select Min(field4) from table1 where field4 not in(Select Max(field4) from table1)) as 2nmax from table1

  3. select min(field4) as Min,Max(field4) as Max,(select Max(field4) from table1 where field4 not in(Select Max(field4) from table1)) as 2nmax from table1

  4. None of the Above

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

To find the 2nd maximum value, we need to find the maximum value from the set of records that excludes the overall maximum. The query in option C correctly does this: the subquery gets MAX(field4) WHERE field4 is NOT IN the list containing the single maximum value. This returns the second highest value. Options A and B use MIN incorrectly in the subquery, which would give the minimum value, not the second maximum.

Multiple choice technology databases
  1. Corelated Subquery

  2. Index

  3. TOP()

  4. None

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

Correlated subqueries can often replace row-by-row cursor operations and significantly improve performance. Cursors are slow because they process one row at a time with frequent context switching. A correlated subquery executes set-based operations which are optimized by the query engine. Indexes (option B) improve data access but don't replace row-by-row logic. TOP() (option C) returns a specified number of rows but doesn't perform row-by-row operations.