CYBER WEEK - EXTRA SAVINGS EVENT
TRY A FREE LESSON

SQL Fundamentals Step 4 Subqueries

https://app.dataquest.io/m/255/subqueries/4/returning-multiple-results-in-subqueries

I don’t understand exactly what we are looking for. Maybe phrasing the question in 100% English would help me. An executive would come to a SQL programmer and say “I want to know how many of these and that are doing something but they also need to be so and so. The reason I want to know this is because.”

“Because” is the operative word that bridges the gap between executives and programmers.

1 Like

Hi @georgemusick,

Thank you for the feedback! I would like to understand more about it. Let’s continue our conversation in the direct message I have sent you.

Best,
Sahil

Hi! I have the same problem. I can’t understand what we are looking for how is de logic of the code.
Maybe somene can explain me.

Thank you!

I’ve tried to rewrite the instructions from a slightly different perspective. The logic that we’re describing is a little bit tricky, so don’t be disheartened that you don’t get it at first.

Write a query that returns a table with two columns: Major and Major_category. Filter the rows so that they only contain rows where the Major_category is one of the five largest categories by Total number of students who studied it.

Does this help? If it does, let me know as we’ll consider updating the instructions for this screen.

1 Like

Hi, your clarification helped me to get the idea, thanks for that. Appreciate it.

1 Like

I don’t understand why this query doesn’t work and why the subquery is necessary (although when I run it, I clearly see the total isn’t sorted in descending order but I don’t understand why):

SELECT Major, Major_category, Total
FROM recent_grads
Group by Major_category
Order By SUM(Total) DESC
Limit 5

Hi josh,i don’t really get it if you can clarify more,thanks btw

Hello, in the answer code - could someone explain why you don’t have to specify the SUM(Total) column in SELECT?

1 Like