Last answered:

18 Oct 2024

Posted on:

16 Oct 2024

0

I have a question about advanced Sql course exam

the fifth question(How manay artists had albums at the top 100 charts for fewer weeks than the average? but the code SUM(CASE WHEN a.no_weeks_top_100 < c.avg_no_weeks_top_100 THEN 1 ELSE 0 END) counts how many artists have a no_weeks_top_100 value that is less than the average calculated in the CTE. For every artist below average, it's the opposite, am I wrong?
3 answers ( 0 marked as helpful)
Instructor
Posted on:

16 Oct 2024

0
Hi Salaheddine!

Thanks for reaching out.

You mean the last coding question, right?
What do you mean by "for every artist below average, it's the opposite", please? I think you mean what the question asks about - How many artists have had albums that have been on the top 100 chart for a period shorter than the average one.
To obtain the average period on the top 100 charts we use a CTE.

Does this help?
Best,
Martin
Posted on:

16 Oct 2024

0
I didn't understand the question, does it mean below the average or higher the average?
Instructor
Posted on:

18 Oct 2024

0
Hi Salaheddine!
Thanks for your reply.
Below the average.
Hope this helps.
Good luck!
Kind regards,
Martin

Submit an answer