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. 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

Statement Q is correct because primary key and 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.

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

Statement 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. Statement 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. Statement 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. Schema, Base and Table

  2. Base, Table and Schema

  3. Key, Base and Table

  4. Schema, Table and View

  5. None of these

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

In SQL, DDL (Data Definition Language) includes CREATE commands. The three main database objects you can create are Schema (for organizing database objects), Table (for storing data), and View (for virtual tables based on queries).