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

  2. False

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

Standard SQL does not allow group (aggregate) functions like SUM, AVG, or COUNT directly in the WHERE clause because the WHERE clause filters rows before grouping occurs. To filter groups based on aggregate results, the HAVING clause must be used instead, making the statement false.

Multiple choice technology programming languages
  1. True

  2. False

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

It is not mandatory to specify the table name along with the column name in a join condition unless the column names are ambiguous (i.e., they exist in multiple tables). If the column names are unique across the joined tables, the database can resolve them without table prefixes, making the statement false.

Multiple choice technology programming languages
  1. Table1.column1=Table2.column2

  2. Table1.column1=Table2.column1

  3. Table1.column2=Table2.column1

  4. None of the above

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

An equi-join requires equality between columns with the same name from both tables. Option B shows Table1.column1 = Table2.column1, which matches identical column names. Options A and C join different columns (column1 to column2), which would be a non-equi-join unless explicitly aliased.

Multiple choice technology programming languages
  1. 9

  2. 11

  3. 5

  4. 12

  5. None of the above

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

To join N tables together, the minimum number of join conditions required to avoid a Cartesian product is N - 1. For 10 tables, we need at least 9 join conditions. Specifying fewer will result in an incomplete join, while specifying more is not the minimum requirement.

Multiple choice technology programming languages
  1. Return records which have no direct match

  2. Return records which have direct match

  3. Return all the records

  4. None of the above

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

An outer join returns all records from one table and matching records from another, or all records from both tables. The key characteristic is that it includes records without direct matches (unlike inner joins). Option A best captures this essential behavior among the choices.

Multiple choice technology programming languages
  1. Group By

  2. NVL

  3. Order By

  4. Include NULL

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

Group functions (like SUM, AVG, COUNT) ignore null values by default. The NVL function converts null values to a specific default value (such as 0 or a placeholder) before the group function is applied, forcing group functions to include those records. Group By and Order By are syntax clauses, and 'Include NULL' is not a standard SQL function.

Multiple choice technology platforms and products
  1. Control Center Manager

  2. Configuration Properties

  3. Mapping Editor

  4. Pallete

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

In Oracle Warehouse Builder (OWB), parallel hints on tables are configured within the Configuration Properties of the mapping or table object. Other components like the Mapping Editor or Control Center Manager are used for designing logic or deploying and running objects, not configuring low-level physical parallel execution properties.

Multiple choice technology programming languages
  1. It can be used to join a maximum of three tables

  2. It can be used to restrict the number of columns used in a NATURAL join

  3. It can be used to access data from tables through equijoins as well as nonequijoins

  4. It can be used to join tables that have columns with the same name and compatible data types

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

The USING clause restricts the columns compared in joins to specified shared columns, resolving ambiguity from NATURAL joins. It requires columns with the same name and compatible data types for equijoins. It cannot be used for nonequijoins or to join more than two tables directly.

Multiple choice technology programming languages
  1. The numbers generated by a sequence can be used only for one table

  2. DELETE <sequencename> would remove a sequence from the database

  3. CURRVAL is used to refer to the last sequence number that has been generated

  4. When the MAXVALUE limit for a sequence for reached, you can increase the MAXVALUE limit by using the ALTER SEQUENCE statement

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

CURRVAL returns the most recently generated sequence number for the current session. When a sequence hits its MAXVALUE, its maximum limit can be increased using the ALTER SEQUENCE statement. DELETE is used for rows, not dropping database objects like sequences.

Multiple choice technology programming languages
  1. They can contain a subquery within a subquery.

  2. They can return multiple columns as well as rows.

  3. They cannot contain a subquery within a subquery.

  4. They can return only one column but multiple rows.

  5. They can contain group functions and GROUP BY and HAVING clauses.

  6. They can contain group functions and the GROUP BY clause, but not the HAVING clause.

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

Multiple-row subqueries can be nested (subquery within a subquery), can return multiple columns along with rows, and support group functions with GROUP BY and HAVING clauses for advanced data aggregation and filtering.