Exercise #32 page 2 |
||
Here’s another query posted on the forum. Solution 3.14.2
You can see another solution. Here we have grouping by countries, full outer join and application of ISNULL(var, sub) — – returns var unless it’s NULL, otherwise returns sub; POWER(var, N) — returns var raised to the power of N. Despite the obvious difference, this query contains the same mistake as the previous one. One ship could be counted multiple times if it was involved in several battles. Try to fix this mistake without changing the solution logic. Below you can find three solutions containing different errors. Namely, there is some data for each solution that produce a non-recurrent result in other solutions. So, let’s take a closer look only on “unique” mistakes. |