Manipulation 7/10 - CROSS JOIN Logic Error?


The instructions for this task says that we’re looking for the COUNT(*) of customers who were subscribed to the newspaper during March (3). And the logic we are instructed to use returns a quantity of 8. (start_month < 3, end_month > 3)

However, I contend that this logic is flawed, and that we should be using:
start_month > 4 or start_month >= 3
end_month > 2 or end_month >= 3

That way, new customers who began their subscriptions in March, or those who will be receiving a newspaper in March but not in April are included. My argument returns a count of 13.

“Logic” is my greatest hurdle in coding. So I’m curious which version is most accurate.



Hello :slight_smile:

If I would be assigned to the implementation of this task in a normal job I would definitely ask product owner or an analyst to make sure that this is what they want. You have good instinct :slight_smile:

But I don’t think that instructions are flawed. “Let’s start by counting the number of customers who were subscribed to the newspaper during March” may mean that we are insterested in customers who stay subscribed throughout whole month.

I know that this is likely a typo, but just to clarify this for other readers. This condition:

start_month > 4 or start_month >= 3

does not make sense (these customers started subscription after March). This is what you probably meant:

start_month < 4 or start_month <= 3


I can’t figure out this question also and can’t move forward.


In case it’s of some help:


select count(*)
from newspaper
where start_month < 3 and end_month >3;


select *
from newspaper
CROSS JOIN months;


select *
from newspaper
WHERE month > start_month and month < end_month;


SELECT month,
  COUNT(*) as subscribers
FROM newspaper
WHERE month > start_month
  AND month < end_month
GROUP BY month;


Well, it’s nice to see the answer and thereby be able to move on. Thank you, @ldouchy
And thank you @factoradic for your input above.
I was doing fine up to this point and then question 4 was totally unclear to me. I could review Aggregate Functions and see if that makes it click at all. Or maybe I could just ponder “aggregate” as a verb for a while…
Also, I think that’s the first time I’ve ever used a comma. Since when do we use commas? What’s the comma for?

I do think there should be a little more instruction there and a really good hint!

Can anybody help me by offering some clarification so that I might better understand question 4. I realize that’s not very specific, so maybe just try and explain it as if it were in the “Learn” section rather than in the Instructions.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.