BLACK FRIDAY EXTRA SAVINGS EVENT - EXTENDED
START FREE

Break Down For Better Understanding

Screen Link:

My Code:
SELECT
CASE
WHEN (
SELECT count(*)
FROM customer
where country = c.country
) = 1 THEN “Other”
ELSE c.country
END AS country

Replace this line with your code

What I expected to happen:
I was wondering if anyone could break down this CASE Statement and What is it counting and how they set it = 1

What actually happened:

Replace this line with the output/error

Correlated subqueries: CASE and Subqueries

@nityesh
This missing concept in solution is causing way too many repeated questions. I’m wondering, assuming the lesson material cannot be edited, can certain forum contributions be linked to from the lesson? That would probably mean freezing the forum post, or implicitly doing that by adding an icon or something so the author doesn’t edit it anymore.

1 Like

Hey @hanqi! Thanks for bringing this to my notice.

I have run this with my team and we’ve notified the content team about this problem.

I’m wondering - are you interested in writing an article (in DQ Direct) about SQL Cases? It seems like it would help a lot of people in our community and you are the best person to write it.

I can then add relevant tags to that article so that whenever someone clicks on the “Community Discussion” button from the screen, they are shown this article.