I cannot seem to figure out why the customer table is filtered by “where country = c.country” in the CASE clause in the country_or_other table in the initial portion of the code, and I am having difficulty understanding the final query, particularly why we cannot use the sum of the total values in the invoice table to calculate the total sales.
I am also stuck with exactly same questions you posted here. I tried to go though the links provided by @Rucha, but still could not get the questions answered. I see that you were able to find the answers. If it is okay with you, could you please give me an explanation for these questions, esp for the below one.