Step 1: Order the table by 'total' in descending order.
rank |
nation |
gold |
silver |
bronze |
total |
1 |
united states |
24 |
12 |
8 |
44 |
2 |
russia |
5 |
5 |
6 |
16 |
3 |
canada |
1 |
2 |
7 |
10 |
4 |
japan |
1 |
4 |
3 |
8 |
5 |
estonia |
1 |
2 |
1 |
4 |
5 |
italy |
0 |
3 |
1 |
4 |
6 |
south korea |
0 |
0 |
3 |
3 |
7 |
france |
0 |
1 |
1 |
2 |
7 |
ukraine |
0 |
1 |
1 |
2 |
8 |
spain |
0 |
1 |
0 |
1 |
8 |
china |
0 |
1 |
0 |
1 |
8 |
czech republic |
0 |
0 |
1 |
1 |
Step 2: Select row number 1 where 'nation' is 'ukraine'.
rank |
nation |
gold |
silver |
bronze |
total |
1 |
united states |
24 |
12 |
8 |
44 |
2 |
russia |
5 |
5 |
6 |
16 |
3 |
canada |
1 |
2 |
7 |
10 |
4 |
japan |
1 |
4 |
3 |
8 |
5 |
estonia |
1 |
2 |
1 |
4 |
5 |
italy |
0 |
3 |
1 |
4 |
6 |
south korea |
0 |
0 |
3 |
3 |
7 |
france |
0 |
1 |
1 |
2 |
7 |
ukraine |
0 |
1 |
1 |
2 |
8 |
spain |
0 |
1 |
0 |
1 |
8 |
china |
0 |
1 |
0 |
1 |
8 |
czech republic |
0 |
0 |
1 |
1 |
Step 3: Select rows where 'total' is 2.
rank |
nation |
gold |
silver |
bronze |
total |
7 |
ukraine |
0 |
1 |
1 |
2 |
Step 4: Use a `CASE` statement to return TRUE if the number of rows is equal to 1, otherwise return FALSE.
rank |
nation |
gold |
silver |
bronze |
total |
7 |
ukraine |
0 |
1 |
1 |
2 |