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. SQL cannot support object-orientation

  2. The same query can be written in many ways, each with vastly different execution plans.

  3. SQL syntax is too difficult for non-computer professionals to use

  4. SQL creates excessive locks within the database

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

A major problem with SQL is that logically equivalent queries can be written in multiple ways, and each variation may produce vastly different execution plans. This makes query optimization challenging - a simple syntax change can dramatically affect performance.

Multiple choice technology databases
  1. *

  2. /

  3. -

  4. =

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

In SQL*Plus, the hyphen (-) character is used to continue a SQL statement on the next line when a statement is too long. The asterisk (*) is a wildcard for SELECT, the forward slash (/) executes the current buffer, and equals (=) is used for substitution variables, not statement continuation.

Multiple choice technology databases
  1. select * from EMP where nvl(EMPNO, '00000') = '59384';

  2. select * from EMP where EMPNO = '59384';

  3. select EMPNO, LASTNAME from EMP where EMPNO = '59384';

  4. select 1 from EMP where EMPNO = '59834';

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

To solve this question, the user needs to understand the concept of indexes and how they work. An index is a data structure that improves the speed of data retrieval operations on a database table. It is created on one or more columns of a table to allow faster search and retrieval of data based on the values stored in those columns.

Now, let's go through each option and determine whether or not it will use the associated index on EMPNO:

A. select * from EMP where nvl(EMPNO, '00000') = '59384';

This option will not use the associated index on EMPNO. The nvl function in the where clause of this query will cause a full table scan to be performed instead of using the index. This is because the function modifies the column value, making it impossible to use the index for a direct lookup.

B. select * from EMP where EMPNO = '59384';

This option will use the associated index on EMPNO. The query filters on the exact value of EMPNO, which makes it possible to use the index for a direct lookup.

C. select EMPNO, LASTNAME from EMP where EMPNO = '59384';

This option will use the associated index on EMPNO. The query filters on the exact value of EMPNO and only selects the EMPNO and LASTNAME columns, making it possible to use the index for a direct lookup and avoid accessing the table rows.

D. select 1 from EMP where EMPNO = '59834';

This option will use the associated index on EMPNO. The query filters on the exact value of EMPNO, and although it does not retrieve any column values, the index can still be used to perform the lookup and avoid the full table scan.

Therefore, the option that will not use the associated index on EMPNO is:

A. select * from EMP where nvl(EMPNO, '00000') = '59384';

The Answer is: A

Multiple choice technology databases
  1. Indexes are only used in special cases

  2. Indexes are used to make table storage more efficient

  3. Indexes rarely make a difference in SQL performance

  4. Indexes exist solely to improve query speed.

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

Indexes exist specifically to accelerate data retrieval by providing optimized lookup paths. While indexes do consume storage (B), they are not for storage efficiency. They are widely used (contrary to A and C) and their primary purpose is query performance improvement.

Multiple choice technology databases
  1. 8

  2. 2

  3. 3

  4. 4

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

To avoid a cartesian product when joining N tables in a query, a minimum of N - 1 join conditions must be specified in the WHERE clause. Therefore, joining four tables requires at least three join conditions to properly relate all records without generating redundant combinations.

Multiple choice technology databases
  1. Me.DataBindings.Add(“chkIsEmployee.Checked”, dsOrg, “Users.IsEmployee”)

  2. chkIsEmployee.DataBindings.Add(“Checked”, dsOrg, “IsEmployee”)

  3. chkIsEmployee.Text = “{Users.IsEmployee}” chkIsEmployee.AutoCheck = True

  4. chkIsEmployee.DataBindings.Add(“Checked”, dsOrg, “Users.IsEmployee”)

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

DataBinding syntax requires: control.DataBindings.Add("PropertyName", dataSource, "DataMember"). For checkbox Checked property binding to Users.IsEmployee, the correct syntax is chkIsEmployee.DataBindings.Add("Checked", dsOrg, "Users.IsEmployee").

Multiple choice technology databases
  1. Indexes use B-TREE for searching data.

  2. Can create more than one non clustered index on a table.

  3. Up to 256 columns can be combined into a single composite index key.

  4. If not specified, a nonclustered index is created.

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

SQL Server indexes do use B-TREE structures (A is true), allow multiple nonclustered indexes per table (B is true), and create a nonclustered index by default when not specified (D is true). However, the limit for composite index columns is much lower than 256 - it's 16 columns (32 in some newer versions with limitations), making option C incorrect.

Multiple choice technology databases
  1. Primary key access

  2. Access via unique index

  3. Table access by ROWID

  4. Full table scan

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

ROWID is the direct physical address of a row's location on disk, making it the fastest access method. Primary key and unique index accesses require an index lookup first, then ROWID access. Full table scan reads every row in the table, making it the slowest method.

Multiple choice technology databases
  1. SQL cannot support object-orientation

  2. The same query can be written in many ways, each with vastly different execution plans.

  3. SQL syntax is too difficult for non-computer professionals to use

  4. SQL creates excessive locks within the database

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

SQL's declarative nature allows the same query to be written in multiple syntactically different ways, which can result in vastly different execution plans and performance. This is a well-known challenge in SQL optimization. SQL does support object-oriented features through extensions, its syntax is widely used by non-programmers, and locking behavior is configurable.

Multiple choice technology programming languages
  1. True

  2. False

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

SEARCH operations do not require an index - a database can perform a full table scan to find matching rows. However, searches are much faster and more efficient with an index. Without an index, the database must examine every row in the table, which is slow for large tables but still functional.

Multiple choice technology
  1. If selected, case-sensitive string comparisons are done in joiner

  2. A normal or master outer join performs faster than a full outer or detail outer join

  3. A master outer join ONLY keeps all rows of data from the detail source

  4. Sorted input can be used for joiner

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

A master outer join in Joiner transformation keeps all rows from the MASTER source, not the detail source. This is the opposite of what option C states, making it the false statement that the question asks for. The other options are true: case-sensitive option exists for string comparisons, master outer join is generally faster than full/detail outer, and sorted input can improve joiner performance.

Multiple choice technology databases
  1. before performing an export/import

  2. immediately after an upgrade or applying a maintenance pack

  3. converting to multiple organizations or multiple reporting currencies

  4. after a patch or multiple patches are applied

  5. whenever you receive a run-time error that suggests that a problem is caused by the AD_DDL package

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

Running validation on the APPS schema is most critical after applying patches (when schema changes are most likely) and when encountering run-time errors suggesting AD_DDL package issues (indicating potential corruption). The other options like before export/import or during organizational conversion are not the primary validation triggers - validation should be done after changes, not before them.