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 web technology
  1. DAVERAGE

  2. AVERAGEDATE

  3. AVGDATE

  4. DGET

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

DAVERAGE is a database function that calculates the average of values in a column of a database list that match specified conditions. The 'D' prefix indicates it's a database function, not the regular AVERAGE function. Options like AVERAGEDATE and AVGDATE don't exist in Excel.

Multiple choice technology databases
  1. Beans and Objects

  2. Settings and Properties

  3. settings and getting

  4. configuration and Creations

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

The main iBATIS XML configuration file uses settings and properties elements to configure framework behaviors, such as lazy loading, transaction management, and database connection pools.

Multiple choice technology databases
  1. True

  2. False

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

SQL keywords and function names are case-insensitive in standard SQL. SELECT, select, and Select are all treated identically. However, string literals and identifiers (depending on database settings) may be case-sensitive.

Multiple choice technology databases
  1. select col1,col2 from table_a order by col2,col1 desc

  2. select col1,col2 from table_a order by 2,col1 desc

  3. select col1,col2 from table_a order by 2,1

  4. select col1,col2 from table_a order by 1,col2

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

ORDER BY accepts column names (option A) or ordinal positions (option C). Options B and D incorrectly mix ordinal positions with column names in a way that breaks SQL syntax consistency in some databases.

Multiple choice technology databases
  1. select col1 from table_a where col1 > 0 and col1 <11

  2. select col1 from table_a where col1 >= 0 and col1 <11

  3. select col1 from table_a where col1 >= 0 and col1 <= 11

  4. select col1 from table_a where col1 > 0 and col1 < =11

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

The SQL BETWEEN operator is inclusive of both endpoints. BETWEEN 0 AND 11 includes values 0 and 11, which translates to col1 >= 0 AND col1 <= 11. Options A and B incorrectly exclude one or both endpoints, and D has a syntax error with a space in the <= operator.

Multiple choice technology databases
  1. Shut down and restart the database.

  2. Use EM Database Control to recompile the object.

  3. Export the invalid objects, drop them, and then import them.

  4. Use the ALTER FUNCTION … COMPILE and ALTER VIEW … COMPILE commands.

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

EM Database Control provides a recompile option for invalid objects directly in its interface. Additionally, you can use ALTER FUNCTION ... COMPILE and ALTER VIEW ... COMPILE commands to manually recompile specific PL/SQL objects. Shutting down the database won't fix invalid objects, and export/import is unnecessarily complex for simple recompilation.