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
  1. It uniquely identifies a row in a table.

  2. Its attributes cannot be duplicated in a row.

  3. It cannot be null.

  4. It is mandatory to provide input for the primary key attributes.

  5. It can be a composite key.

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

Primary key is chosen by a designer to uniquely identify rows in the table. It is always not null and unique. A null value can be used to represent an unknown data.

Multiple choice
  1. It is used to define the end of a transaction.

  2. It defines change and drops the structure of a table.

  3. It is used to modify and delete data from a table.

  4. It has SELECT as a SQL keyword.

  5. It can remove all rows from a table.

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

Data control line (DCL) is a type of SQL statement. It is used to provide control over the data in a database and to define the end of a transaction.

Multiple choice
  1. select empname from emp where datediff(curdate(),joiningdate)>20;

  2. select empname from emp where datediff(curdate(),joiningdate)>200;

  3. select empname from emp where datediff(joiningdate,curdate())>200;

  4. select from emp where datediff(curdate(),joiningdate)>200;

  5. none of these

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

datediff produces the difference of its two arguments in days. Hence currentdate, when subtracted with the joining date gives the number of days.

Multiple choice
  1. Deletes

  2. Disables

  3. Creates

  4. Changes

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

In SQL, the DROP command is used to remove an entire database object, such as a table or a database, permanently from the system.

Multiple choice
  1. A String

  2. A Statement

  3. A Query

  4. A Variable

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

An SQL statement is a command or instruction sent to a database management system to perform an action, commonly referred to as a query.