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 trialJames Goedicke
2,205 PointsI have taken this quiz several times and have put in a query that matches the query discussed in the training,
I have tried several times on the test with this query and variations of it. I can not describe the table or query the data to check it. I am not able to see what is wrong. Any assistance would help. I asked and was told there is not a Data Table, but I have racked my brain on this.
4 Answers
Steven Parker
231,265 PointsYou nearly had it! But you don't need the "S.*
" you can select simply "*
". Also, you can omit the aliases inside the subquery (but that won't affect passing):
SELECT * FROM Sale AS S
INNER JOIN (SELECT CustomerID FROM Customer WHERE Gender = 'F') AS C
ON S.CustomerID = C.CustomerID;
Beats me why "S.*" won't also pass, seems like it should.
Steven Parker
231,265 PointsIf you're working on task 1, the instructions say "... there is a Model table ... and a Car table...".
But if you're on a different task, be sure to identify it when you show your code.
James Goedicke
2,205 PointsSorry, I thought my post would include my current state. Below is the text of the question (I am retyping so please understand any typos):
In a car database there is a Sale table with columns, SaleID, CarID, CustomerID, LocationID, SalesRepID, SaleAmount and SaleDate and a Customer table with Columns, CustomerID, FirstName, LastName, Gender and SSN. Use a subquery as a derived table to show all sales to female ('F') customers, Select all columns from the Sale Table only.
My most recent failure was:
SELECT S.* FROM Sale AS S INNER JOIN ( SELECT Cust.CustomerID FROM Customer AS Cust WHERE Cust.Gender = 'F') AS C on S.CustomerID = C.CustomerID;
The error I received is "Bummer; Your query didn't return all columns from the Sale table for who's CustomerIDs belong to people who identify as female!
I have been working on this and stuck for almost 6 months. I asked Team Treehouse and was told some people are passing this. I am not new to SQL and have use Derived tables many times. I have tried this using different Alisas for the Derived table from the Table, not using Aliases at all, etc.
Any thoughts?
Note: I am not trying to cheat, I have tried may different versions of this and since I can not doe a test display of the data I can not tell where the error is. I am just trying to figure out why what seems right is continuing to fail.
James Goedicke
2,205 PointsThanks Steven, I do not know why the S Alis on S.*, did not work especially since the requirements say select all from the Sale Table only, but it worked.
Michael Hulet
47,913 PointsMichael Hulet
47,913 PointsWe can't really help without seeing the code you wrote. Would you mind posting it here?