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. Structured Query Luggage

  2. Structured Query Language

  3. Structured Quite Language

  4. Standard Query Language

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

Correct answer is (2). 

Multiple choice
  1. SELECT product_name FROM product WHERE country= 'US'

  2. SELECT product_name FROM product WHERE product_name IN (SELECT product_name FROM Product WHERE country= US)

  3. SELECT product_name FROM product WHERE product_name IN (SELECT product_name FROM Product WHERE country= 'US')

  4. Both (1) and (3)

  5. None of the above

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

Both are the correct queries.

Multiple choice
  1. SELECT first_name, last_name, subject FROM student_details WHERE subject = 'Economics'

  2. SELECT first_name, last_name, subject FROM student_details WHERE marks>90

  3. SELECT first_name, last_name, subject FROM student_details WHERE marks=>90

  4. Both (1) and (3)

  5. None of the above

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

This is example of equi-join as it has equal operator.

Multiple choice
  1. SELECT product_name, sum(product_price) FROM product

  2. SELECT product_name, product_price FROM product group by state

  3. SELECT product_name, sum(product_price) FROM product group by state

  4. SELECT sum(product_price) FROM product group by state

  5. None of the above

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

This is a correct SQL query for the specified result.

Multiple choice
  1. SELECT product SET product_name='Jeans' WHERE product_price> 2000

  2. UPDATE product _nameSET product_name='Jeans' WHERE product_price> 2000

  3. UPDATE product SET product_name='Jeans' WHERE product_price> 2000

  4. UPDATE product SET product_name='Jeans' WHERE product_price IN (Select MAX (product_price) from product)

  5. None of the above

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

This is the correct SQL query for the specified result.

Multiple choice
  1. SELECT student_id, first_name FROM student WHERE subject IN (SELECT first_name FROM student WHERE subject= 'Maths');

  2. SELECT student_id, first_name FROM student WHERE first_name IN (SELECT first_name FROM student WHERE subject= 'Maths');

  3. SELECT student_id, first_name FROM student WHERE student_id IN (SELECT first_name FROM student WHERE subject= 'Maths');

  4. SELECT student_id, first_name FROM student WHERE first_name IN (SELECT student_id FROM student WHERE subject= 'Maths');

  5. None of the above

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

This is a correct query for specified result.

Multiple choice
  1. SELECT a.student_id, a.name, b.total_marks FROM student a, marks b WHERE a.student_id = b.student_id AND total_marks >80;

  2. SELECT a.student_id, a.name, b.total_marks FROM student a, marks b WHERE a.student_id = b.student_id AND a.total_marks >80;

  3. SELECT a.student_id, a.name, b.total_marks FROM student a, marks b WHERE a.student_id = b.student_id AND b.total_marks >80;

  4. SELECT a.student_id, a.name, b.student_id, b.total_marks FROM student a, marks b WHERE a.student_id = b.student_id AND a.total_marks >80;

  5. None of the above

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

This is a correct query as we are joining the two tables to match their Ids and then displaying the desired result.