Home » MYSQL » Mysql miscellaneous » Question
  1. Consider a database name “interviewmania” 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 interviewmania
    WHERE subject IN (SELECT subject FROM interviewmania WHERE subjectvalue IN (3, 2));
    1. {1, 2, 3, 4, 5, 6}
    2. {3, 4}
    3. {1, 2, 3}
    4. {5, 6}
    5. None of these
Correct Option: A

Only those value will be selected whose subjects are c, c++, sql, oop. In the sub query subject_value=3 OR 2 which belongs to subject {c, c++, sql, oop} after that this subject belong to intern_id (1, 2, 3, 4, 5, 6).



Your comments will be displayed only after manual approval.