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

  2. secondary key

  3. candidate key

  4. composite Key

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

A foreign key is an attribute (or set of attributes) in one table that references the primary key of another table, establishing a relationship between the two tables. This constraint enforces referential integrity between related tables in the database.

Multiple choice
  1. Delete

  2. Remove

  3. Truncate

  4. Both (1) and (2)

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

Both DELETE and REMOVE can remove rows from tables in various database systems. DELETE is standard SQL. TRUNCATE removes all rows but keeps table structure. The question is slightly ambiguous as 'remove' is not standard SQL.

Multiple choice
  1. Finds any values that end with 2

  2. Finds any values that start with 2 and are at least 3 characters in length

  3. Finds any values in a five-digit number that start with 2 and end with 3

  4. Finds any values that have 2 in the second position and end with 3

  5. None of these

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

As % denotes any number of digits or character,s it should be given between 2 and 3. 3 should be given at the end and 2 at second position, _2 SELECT * from Employee WHERE SALARY LIKE '_2%3'.

Multiple choice
  1. MAX and MIN functions work on numeric and non-numeric data.

  2. SUM and AVERAGE work on numeric data.

  3. Aggregate functions do not work on complex mathematical expressions like log, square root, etc.

  4. SUM and AVERAGE work on non-numeric data.

  5. There is no influence of distinct keywords in aggregate function.

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

MIN and MAX functions work on non-numeric data, but SUM and AVERAGE do not work on non-numeric data.