FAQ: Usage Funnels - Build a Funnel From a Single Table

This community-built FAQ covers the “Build a Funnel From a Single Table” exercise from the lesson “Usage Funnels”.

Paths and Courses
This exercise can be found in the following Codecademy content:

FAQs on the exercise Build a Funnel From a Single Table

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Why doesn’t this code work?

I don’t see a typo, and the only difference is the order of my selections:

 SELECT COUNT(DISTINCT user_id), question_text
 FROM survey_responses
 GROUP BY 2;

This actually returns the identical result, it just doesn’t receive credit. The interface returned an error message saying to enter the appropriate code and didn’t give me the [Next] box.

In this exercise, why is it necessary to count DISTINCT user?

2 Likes

Maybe one user answered questions twice?

I don’t understand why are we grouping and ordering by 1.

For this exercise,
Instead of using suggestion below;

SELECT question_text,
   COUNT(DISTINCT user_id)
FROM survey_responses
GROUP BY 1;

Can I write query like this instead?

SELECT DISTINCT user_id,count(*),question_text

 FROM survey_responses

 GROUP BY question_text;

I must admit I had a peek at the solution before asking this question. Why does the query show entries in the question_text column entered in a random order? Also, how is it that the result shows the question_text column in a descending order despite not using the ORDER BY clause?

1 Like

well totally the same. I check the code again and again just doesnt work.
actually i have same problems many times, even you get the same code it just gives you an X.

It’s been a while since I’ve done the lesson. Can you post a link to it?

In my code i used … COUNT(user_id) but the hint/answer code used COUNT(DISTINCT user_id), what is the point of DISTINCT in an aggregate query? (both codes give the same answer)

Both approaches return the same information in this instance. This may not always be the case, particularly if user_id isn’t the index (PRIMARY KEY) for the database.

I have the problem, never succeeded until I peeked the hint.

1 Like

Because we need to get amount of users have answered to the particular question. Some users could answer to the questions twice, three, four times… When we use DISTINCT we get max amount of answered questions for this user.

Yes you can, but in the result you’ll get 3 column and the first column consists of 5 identical rows with on of the user’s id…