A

Admin • 833K Points
Coach

Q. Consider a database name "db_name" whose attributes are intern_id (primary key), subject, subject_value.
Intern_id = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
Subject_value = {0, 0, 1, 1, 2, 2, 3, 3}
If these are one to one relation then what will be the output of the following MySQL statement?
SELECT intern_id
FROM db_name
WHERE subject IN (SELECT subject FROM db_name WHERE subject_value = 3);

  • (A) {5, 6}
  • (B) {1, 2, 3}
  • (C) {3, 4}
  • (D) None of the mentioned
  • Correct Answer - Option(A)
  • Views: 28
  • Filed under category MySQL
  • Hashtags:

Explanation by: Admin

This question is about how to use SQL to find specific data in a database. Let's break it down:

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.