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 databases
  1. True

  2. False

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

Both queries replace 'a' with 'd' in 'abcd'. TRANSLATE('abcd','a','d') converts single character 'a' to 'd', giving 'dbcd'. REPLACE('abcd','a','d') replaces substring 'a' with 'd', also giving 'dbcd'. With single-character replacement, they produce identical output.

Multiple choice technology databases
  1. Error: Invalid Number

  2. Error: Invalid Character

  3. 0

  4. 1

  5. Error: divisor is equal to zero

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

AVG() requires numeric input, but DUMMY contains 'X' (a string value in DUAL). Oracle cannot convert 'X' to a number, raising ORA-01722: invalid number.

Multiple choice technology databases
  1. Error: Missing expression

  2. connect

  3. It will show connection string name

  4. NULL

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

CONNECT is an Oracle reserved keyword (used for hierarchical queries: CONNECT BY). Using it as a column name without quotes causes 'missing expression' error.

Multiple choice technology databases
  1. It will show one row but no column, no value, not even a NULL value.

  2. 1

  3. 0

  4. NULL

  5. One row with one column containing the ROWID of DUAL's single row (an 18-character rowid string, e.g. AAAADeAABAAAAgiAAA).

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

ROWID is a pseudo-column that exists for every row in Oracle tables. Querying it from DUAL returns the actual 18-character ROWID string (e.g., AAAADeAABAAAAgiAAA) of DUAL's single row.

Multiple choice technology databases
  1. It will show one row but no no column,no value-,not even NULL value

  2. NULL

  3. 0

  4. 1

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

ROWNUM is a pseudo-column that assigns a number to each row returned. DUAL has one row, so ROWNUM=1 for that row. The query returns 1.

Multiple choice technology databases
  1. NULL

  2. Values 3 to 50

  3. 1

  4. 0

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

CONNECT BY generates rows starting at LEVEL=1. The filtering condition LEVEL BETWEEN 3 AND 50 is applied AFTER row generation. But the condition fails for LEVEL=1 and LEVEL=2, stopping generation. Only LEVEL=1 satisfies 1 BETWEEN 3 AND 50 = FALSE, so no rows generated beyond first. Oracle returns just the initial row with LEVEL=1.