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. True, Simple and Complex

  2. False, Simple and Composite

  3. True, Simple and Composite

  4. False, Simple and Complex

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

PROC SQL can create indexes only on tables, NOT on views. Indexes in PROC SQL are classified as Simple (one column) or Composite (multiple columns). Therefore, the statement about views is False, making option B correct.

Multiple choice technology programming languages
  1. True, Simple and Complex

  2. False, Simple and Composite

  3. True, Simple and Composite

  4. False, Simple and Complex

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

PROC SQL cannot create indexes on views because views are virtual tables, not physical data storage. Indexes can only be created on physical tables. PROC SQL supports two index types: Simple (single column) and Composite (multiple columns).

Multiple choice technology programming languages
  1. In simple index, the index name must be same as the column name.

  2. The values must be in sorted form

  3. Indexing helps to retrieve the data faster

  4. All of the above

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

In Proc SQL simple index, the index name defaults to the column name but isn't required to match. Indexing significantly speeds up data retrieval by creating lookup structures. Values don't need to be pre-sorted for indexing to work.

Multiple choice technology mainframe
  1. For Renames Clause

  2. For Condition Names

  3. Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

  4. All of the above

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

Level 66 in COBOL is specifically used for the RENAMES clause, which allows you to regroup existing data items under an alternative name. Level 88 is used for condition names, while level 77 is for independent elementary items. Level 66 cannot serve the purposes described in B or C.

Multiple choice technology databases
  1. 2

  2. 8

  3. 10

  4. None of the above

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

In Oracle SQL, the ROWNUM pseudo-column is assigned sequentially starting at 1. The condition rownum >= 2 is never met because the first row evaluated is assigned ROWNUM 1, which fails the condition, preventing any subsequent rows from being fetched. Thus, 0 rows are returned.

Multiple choice technology databases
  1. 9

  2. 10

  3. 4

  4. 8

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

The format mask '999999.99' in Oracle TO_CHAR specifies 6 digits before decimal (with leading spaces for smaller numbers) and 2 digits after decimal. Converting string '9999' with this mask produces ' 9999.00' which is 10 characters total: 2 leading spaces, 4 digits, decimal point, and 2 decimal digits. The LENGTH function returns 10.

Multiple choice technology databases
  1. 01/01/10

  2. 01/10/10

  3. 17/10/10

  4. It will throw an error

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

The query uses ADD_MONTHS function which adds months to a date. Starting from '17/10/2009', ADD_MONTHS(..., 12) adds 12 months to become '17/10/2010'. The TRUNC function with no arguments truncates to the first day of the month, giving '01/10/2010' (October 1st, 2010). The correct answer is '01/10/10'.