Kate WoodroffePro Student 6,685 Points
Stuck on task 4 of querying relational databases, sub queries assessment
I'm stuck on task 4 of the subquery section of querying relational databases. I have input the code code and I feel like it's right (I've tested equivalent code in SQL playground with the library tables). What is wrong?
The question is:
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 answer is
select s.saleid,s.carid,s.customerid,s.locationid,s.salesrepid,s.saleamount,s.saledate from sale s inner join (select customerid from customer where gender = 'F') c on s.customerid = c.customerid;
Steven Parker177,523 Points
You're very close! But when they say "show all sales", they mean all columns ("
SELECT *") from the sales. Just use the wildcard instead of naming individual columns and you'll pass.
Wow...I had this same issue. The course does not seem to be consistent because when it used the language "show all sales" in a previous exercise, I used the individual column names and it passed. Then in an earlier module when it said "show all..." and I used the "*", it wouldn't pass. Thanks for the post though!
Josh Gabel8,261 Points
I had this same issue. The Challenge text specifically says
Select all columns from the Sale table only.
Someone should adjust the challenge text to reflect the query result the challenge is actually looking for.