Skip to content

Commit a844e88

Browse files
Completed question 4
1 parent 2c5ed6b commit a844e88

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

alexander_connelly_code_challenge.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,32 @@ Asia Europe Rest of World
260260
28.3% 42.2% 29.4%
261261

262262
PS:
263-
I didn't like/ understand what the question was asking and took a sum of each continents GDP per capita instead of any other metric for the sake of time. However this metric is a bit strange but this data needs more information in order to properly answer the question, EG, population of each country in the year 2012 to get GDP of each country. Otherwise, continents with more countries are skewed simply because there are more of them, not necessarily a reflection of true GDP % share.
263+
I have a question to better understand what the question is asking but instead made an assumption and took a sum of each continents GDP per capita instead of any other metric for the sake of time. However this metric is a bit strange but this data needs more information in order to properly answer the question, EG, population of each country in the year 2012 to get GDP of each country. Otherwise, continents with more countries are skewed simply because there are more of them, not necessarily a reflection of true GDP % share.
264264

265265
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?
266266

267+
SELECT
268+
COUNT(*), SUM(gdp_per_capita)
269+
FROM
270+
braintree.gdp_join
271+
WHERE
272+
year = 2007 AND LOWER(country_name) LIKE '%an%';
273+
274+
Result:
267275

276+
count(*) sum(gdp_per_capita)
277+
58 888339.8619685002
268278

269279
4b\. Repeat question 4a, but this time make the query case sensitive.
270280

281+
SELECT COUNT(*), SUM(gdp_per_capita)
282+
FROM braintree.gdp_join
283+
WHERE year = 2007 AND country_name LIKE BINARY '%an%';
284+
285+
Result:
286+
count(*) sum(gdp_per_capita)
287+
56 845004.2528505002
288+
271289
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:
272290

273291
- year

0 commit comments

Comments
 (0)