Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


DERIVED Subquery to find all Female customer sales data (under Challenge Task)

This is Challenge Task #4 for SQL Querying Relational Databases

    INNER JOIN (SELECT * FROM Customer WHERE Customer.Gender = "F") 
        AS f 
            ON s.CustomerID = f.CustomerID;

What am I doing wrong?

Do you have a link to the task?

4 Answers

           INNER JOIN (SELECT customerid FROM customer WHERE gender = 'F') AS c
           ON s.customerid = c.customerid;

On the inner join, I am selecting customerid and you are selecting all.

Steven Parker
Steven Parker
229,968 Points

This gets the right rows, but with much more data than expected.

The challenge is expecting your subquery to select only the customer ID's from the Customers table, not all the columns.

Changing that worked, thanks!

Can you clarify why having all the columns wouldn't work considering all the Males were filtered out?

Steven Parker
Steven Parker
229,968 Points

That "Select all columns from the Sale table only." is your clue. Your current subquery would also give you every column from the Customers table, which is not what the challenge expected to see.

nolan emirot
nolan emirot
2,826 Points

If we specify all the columns instead of "*" it won't work but it's correct...