Home » MYSQL » Mysql miscellaneous » Question
  1. Consider a database name “interveiwmania” whose attributes are internid (primary key), subject, subjectvalue.
    Internid = {1, 2, 3, 4, 5, 6}
    Subject = {sql, oop, sql, oop, c, c++}
    Subjectvalue = {0, 0, 1, 1, 2, 2, 3, 3}
    If these are one to one relation then what will be the output of the following query?
    SELECT internid
    FROM interveiwmania
    WHERE subject IN (SELECT subject FROM interveiwmania WHERE subjectvalue = 3);
    1. {1, 2, 3}
    2. {3, 4}
    3. {5, 6}
    4. All of above
    5. None of these
Correct Option: C

Only those value will be selected whose subjects are c and c++. In the sub query subjectvalue=3 which belongs to subject {c, c++} after that this subject belong to internid {5, 6).



Your comments will be displayed only after manual approval.