Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Skylar Gordon7,943 Points
What does this return, if it doesn't return all sales to female customers?
So, I am being told by the computer that this is not correct, as it does not return all columns of the rows in the Sale table that have Customer IDs that belong to female customers. If it doesn't return that, what does it return? Since the challenges won't show you what you queried unless you got it right, I can't actually problem solve this until I have that information. (I did a very similar query in the SQL playground for the last task, and got what I thought I'd get, so not being able to see what this queries is the only reason I can't figure this out.)
SELECT s.* FROM Sale AS s INNER JOIN (SELECT CustomerID FROM Customer WHERE Gender = 'F') AS c ON c.CustomerID = s.CustomerID;
Although your query may return the same results the task specifically asks Use a subquery along with IN to list all sales to female customers . It is similar to the previous two tasks.
Josh Gabel13,058 Points
Not sure if you found a solution or not but the challenge appears to be worded incorrectly. It specifically says:
Select all columns from the Sale table only.
However the accepted result is all columns of the Sale table and the result of the derived table. This query will work:
SELECT s.*, c.CustomerID FROM Sale AS s INNER JOIN (SELECT CustomerID FROM Customer WHERE Gender = 'F') AS c ON c.CustomerID = s.CustomerID;