Bird
0
0

You have a junction table MemberGroup with columns MemberID and GroupID. A query:

medium📝 Debug Q7 of 15
SQL - Table Relationships
You have a junction table MemberGroup with columns MemberID and GroupID. A query:
SELECT * FROM MemberGroup WHERE MemberID = 7 AND GroupID = 15;

returns no rows, but you know member 7 belongs to group 15. What could be a reason?
AThe values in the query do not match the actual data types or casing
BThe junction table does not support many-to-many relationships
CThe query syntax is invalid
DMemberID and GroupID are not foreign keys
Step-by-Step Solution
Solution:
  1. Step 1: Understand the problem

    The query returns no rows despite known membership.
  2. Step 2: Possible causes

    Data type mismatch or case sensitivity can cause no matches.
  3. Step 3: Eliminate other options

    Junction tables support many-to-many; syntax is valid; foreign keys not mandatory for query.
  4. Final Answer:

    The values in the query do not match the actual data types or casing -> Option A
  5. Quick Check:

    Check data types and case sensitivity [OK]
Quick Trick: Check data types and case sensitivity [OK]
Common Mistakes:
MISTAKES
  • Assuming syntax error without checking data
  • Ignoring case sensitivity in string IDs
  • Believing foreign keys must exist for query to work

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes