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
  1. A foreign key in one table is the primary key in the other table.

  2. A foreign key can allow null values but not a primary key.

  3. A table can have more than one unique key.

  4. Foreign key is also called a referencing key.

  5. All of the above

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

All of the above are the true statements.

Multiple choice
  1. A fourth normal should be in 3rd normal form.

  2. There should not be a set of multivalued dependency in fourth normal form.

  3. The transitional functional dependency should be removed from the table in the fourth normal form.

  4. All of the above

  5. Only (1) and (2)

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

Yes, both of these are characteristics of fourth normal form in the database.

Multiple choice
  1. Union clause is used to eliminate the duplicate rows from the result set.

  2. Union all clause shows the duplicacy in the result set.

  3. In self join, we can join a table to itself.

  4. Group by clause can be used to group the result of one or more tables.

  5. All of the above

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

Yes, all of the above are the true statements.

Multiple choice
  1. A view can be based on multiple tables and databases.

  2. The result set of the select statement is used to from the virtual table returned by the view in database.

  3. A view acts as a filter on the underlying tables referenced in the view.

  4. All of the above are true.

  5. Only (2) and (3).

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

Yes, all are the true statements.

Multiple choice
  1. Q only

  2. P only

  3. Both P and Q

  4. Both P and R

  5. R only

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

This is true choice. Q statement is correct because the primary key and the foreign key can exist in the same relation. Moreover foreign key can refer to the primary key in the same relation.So this is correct choice.

Multiple choice
  1. P only

  2. Both P and Q

  3. Both P and R

  4. Both Q and R

  5. All of these

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

Option P is correct because a candidate key is a key that uniquely identifies a row in a relation. So this cannot be null as it uniquely identifies a row.Option R is correct because primary key is chosen from a set of candidate keys. In other words all the candidate keys are the candidates for the primary key. So in this way all the candidate keys are primary keys.So this is the correct answer.Option Q is false because If the primary key is composed of more than one attribute then these attributes are known as prime attributes not super attributes.

Multiple choice
  1. A trigger is executed automatically.

  2. Stores procedure can be invoked explicitly.

  3. A trigger can not return any value.

  4. A stored procedure can not return any value.

  5. None of the above

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

This is a false statement as the stored procedure can return the value.

Multiple choice
  1. It allows multiple values in where clause.

  2. It is used to display records according to specified condition.

  3. It defines that the subquery return atleast one row from the database table.

  4. It is used to sort the data of the table.

  5. None of these

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

It is true about the 'Exists' clause in SQL.