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

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.

Multiple choice technology databases
  1. TEXT

  2. IMAGE

  3. FLOAT

  4. 1) and 2)

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

SQL_VARIANT can store most SQL Server data types except large object types like text, ntext, image, timestamp, and the MAX variants (varchar(max), nvarchar(max), varbinary(max), xml). TEXT and IMAGE are legacy large object types that SQL_VARIANT cannot handle. FLOAT is valid within SQL_VARIANT. The question has a typo (VARIEANT should be VARIANT).

Multiple choice technology platforms and products
  1. True

  2. False

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

Prompt Tables do not always validate against the underlying record. Prompt tables can be used for dropdown lists and selection purposes without performing validation against the actual record data. They serve primarily as a user interface aid to provide valid choices, but the validation logic is separate and configurable.

Multiple choice technology platforms and products
  1. Setting %Date as constant

  2. Required

  3. Specifying Default using Record and Field values

  4. Reasonable date

  5. Validate date

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

The 'Reasonable date' property is specifically designed to validate date fields against logical date ranges, including ensuring dates are not too far in the past or future. This property can be configured to validate that dates fall within a specific range like the last 30 days, preventing invalid or unreasonable date entries.

Multiple choice technology platforms and products
  1. SQL View

  2. Sub Record

  3. SQL Table

  4. Work Record

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

Work Records are in-memory structures used for temporary data storage and processing within PeopleSoft applications. Unlike SQL Tables, SQL Views, and Sub Records which must be built/created in the database, Work Records exist only at runtime and do not require any database build process or physical database objects.

Multiple choice technology databases
  1. True

  2. False

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

You can insert data into certain types of views called updatable views. Simple views (without DISTINCT, aggregations, GROUP BY, joins, or expressions) are inherently updatable. Complex views require INSTEAD OF triggers to allow inserts through the view.

Multiple choice technology programming languages
  1. 20 20

  2. 20 2

  3. 2 2

  4. 2 1

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

The SET statement reads dataset A once (it has 2 observations: SEQID 1 and 2). The DO loop iterates from 1 to 10, but SET only executes once at the start. So we get 2 observations total (one from each row in A). The n variable counts iterations, ending at 2, not 10.

Multiple choice technology programming languages
  1. Observations =2 and Salary = 45000 at both observations

  2. Observations = 2 and Salary = 45000 at first and Salary =. at second observation

  3. Observation = 1 and Salary = 45000

  4. Error

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

The conditional IF n=1 executes only for the first iteration, setting salary. SET score reads both observations (2 rows). The salary variable is retained in the PDV, so both output observations have salary=45000. Result: 2 observations, salary=45000 for both.

Multiple choice technology programming languages
  1. No. of Observations = 2 I = 12

  2. No. of Observations = 10 I = 30

  3. No. of Observations = 4 I = 12

  4. No. of Observations = 3 I = 13

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

The DO loop starts at i=1. Inside, i=i*3 makes i=3 on first iteration. After OUTPUT and END, loop checks i <= 10. Next iteration i becomes 6 (3*3), then 9 (6*3 would be 18 > 10, so only 3 iterations). Final OUTPUT after loop is 4th observation. Final i=9+3=12 (from last multiplication) + 1 from loop increment.