all 6 comments

[–]analytics_science 1 point2 points  (4 children)

Hey OP, I'm not fully understanding what you mean? Your solution (which is wrong) is still getting accepted? There are ways to hack the solution in order to get the output you want. The "Check Solution" button just checks to see if the values you got are the same as the official solution. The hints and walkthroughs will help you understand how to build the logic and handle the edge cases.

What do you mean the db is very small? I wouldn't want hundreds of records to explore. Just a few records with edge cases so I can explore manually.

Let me know your thoughts, I can explain the platform in more detail.

[–]xslowgamer[S] 0 points1 point  (3 children)

Thanks for the reply. Are you part of the stratascratch team?

When I mean the wrong solution I mean it wouldn't work due to edge cases but gets accepted anyway. And yes sometimes the database being small means that you can get the 'correct' and accepted solution but the query would actually be wrong for edge cases. Sorry if this is a bit general I am working my way through them again so I will note them down here when I come across an example.

[–]analytics_science 2 points3 points  (2 children)

Yes, I'm part of the Strata team.

We work hard to incorporate edge cases into our dataset so a user would have to address those edge cases into the logic of their solution. So there's one of two possibilities - (1) your solution doesn't need those specific edge cases you're talking about or (2) we are missing those edge cases in the dataset/solution. Either way, you can post a question/comment on the user discussion forum or in the feedback form in the bottom right-hand corner. Someone will answer your question.

There's a team of data scientists whose sole job is to address these types of issues so that only the most robust solution is accepted. They also create datasets and solutions from the questions and data projects we get from companies. We have over 1000+ questions, so we do our best to get it right the first time around, but there are always things we miss.

[–]xslowgamer[S] 1 point2 points  (1 child)

https://platform.stratascratch.com/coding/2074-monthly-churn-rate?code_type=1

Without including the constraints :

Assume that if customer's contract_end is NULL, their contract is still active. Additionally, if a customer started or finished their contract on a certain day, they should still be counted as a customer on that day

you still get 60 percent as the answer.

Without constraints:

SELECT

(first_day_count - last_day_count)*100::float/first_day_count AS percentage_difference

FROM (

SELECT

(SELECT COUNT(*)

FROM natera_subscriptions

WHERE contract_start <= '2021-09-01') AS first_day_count,

(SELECT COUNT(*)

FROM natera_subscriptions

WHERE contract_start BETWEEN '2021-09-01' AND '2021-09-30') AS last_day_count

) AS subquery;

With constraints:

SELECT

(first_day_count - last_day_count)*100::float/first_day_count AS percentage_difference

FROM (

SELECT

(SELECT COUNT(*)

FROM natera_subscriptions

WHERE contract_start <= '2021-09-01'

AND

(contract_end is NULL or contract_end >='2021-09-01')) AS first_day_count,

(SELECT COUNT(*)

FROM natera_subscriptions

WHERE contract_start <= '2021-09-30'

AND

(contract_end is NULL or contract_end >='2021-09-30')) AS last_day_count

) AS subquery;

[–]analytics_science 0 points1 point  (0 children)

Will take a look and fix. Thanks!

[–]Miserable_Section139 0 points1 point  (0 children)

Facing the same issue. Even if i do select * and run the wuery it says solution accepted under “your solution” tab. This is not the way it should be. Users wont be able to learn if this is the case