Skip to content

Commit 6b067d9

Browse files
create alexander_connelly_coding_challenge.txt
1 parent 82cb96c commit 6b067d9

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

alexander_connelly_code_challenge.txt

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Data Integrity Checking & Cleanup
2+
3+
- Alphabetically list all of the country codes in the continent_map table that appear more than once. Display any values where country_code is null as country_code = "FOO" and make this row appear first in the list, even though it should alphabetically sort to the middle. Provide the results of this query as your answer.
4+
5+
- For all countries that have multiple rows in the continent_map table, delete all multiple records leaving only the 1 record per country. The record that you keep should be the first one when sorted by the continent_code alphabetically ascending. Provide the query/ies and explanation of step(s) that you follow to delete these records.
6+
7+
2\. List the countries ranked 10-12 in each continent by the percent of year-over-year growth descending from 2011 to 2012.
8+
9+
The percent of growth should be calculated as: ((2012 gdp - 2011 gdp) / 2011 gdp)
10+
11+
The list should include the columns:
12+
13+
- rank
14+
- continent_name
15+
- country_code
16+
- country_name
17+
- growth_percent
18+
19+
3\. For the year 2012, create a 3 column, 1 row report showing the percent share of gdp_per_capita for the following regions:
20+
21+
(i) Asia, (ii) Europe, (iii) the Rest of the World. Your result should look something like
22+
23+
Asia | Europe | Rest of World
24+
------ | ------ | -------------
25+
25.0% | 25.0% | 50.0%
26+
27+
4a\. What is the count of countries and sum of their related gdp_per_capita values for the year 2007 where the string 'an' (case insensitive) appears anywhere in the country name?
28+
29+
4b\. Repeat question 4a, but this time make the query case sensitive.
30+
31+
5\. Find the sum of gpd_per_capita by year and the count of countries for each year that have non-null gdp_per_capita where (i) the year is before 2012 and (ii) the country has a null gdp_per_capita in 2012. Your result should have the columns:
32+
33+
- year
34+
- country_count
35+
- total
36+
37+
6\. All in a single query, execute all of the steps below and provide the results as your final answer:
38+
39+
a. create a single list of all per_capita records for year 2009 that includes columns:
40+
41+
- continent_name
42+
- country_code
43+
- country_name
44+
- gdp_per_capita
45+
46+
b. order this list by:
47+
48+
- continent_name ascending
49+
- characters 2 through 4 (inclusive) of the country_name descending
50+
51+
c. create a running total of gdp_per_capita by continent_name
52+
53+
d. return only the first record from the ordered list for which each continent's running total of gdp_per_capita meets or exceeds $70,000.00 with the following columns:
54+
55+
- continent_name
56+
- country_code
57+
- country_name
58+
- gdp_per_capita
59+
- running_total
60+
61+
7\. Find the country with the highest average gdp_per_capita for each continent for all years. Now compare your list to the following data set. Please describe any and all mistakes that you can find with the data set below. Include any code that you use to help detect these mistakes.
62+
63+
rank | continent_name | country_code | country_name | avg_gdp_per_capita
64+
---- | -------------- | ------------ | ------------ | -----------------
65+
1 | Africa | SYC | Seychelles | $11,348.66
66+
1 | Asia | KWT | Kuwait | $43,192.49
67+
1 | Europe | MCO | Monaco | $152,936.10
68+
1 | North America | BMU | Bermuda | $83,788.48
69+
1 | Oceania | AUS | Australia | $47,070.39
70+
1 | South America | CHL | Chile | $10,781.71

0 commit comments

Comments
 (0)