Skip to content

Instantly share code, notes, and snippets.

@mportocarrero
Last active August 29, 2015 13:56
Show Gist options
  • Save mportocarrero/8905142 to your computer and use it in GitHub Desktop.
Save mportocarrero/8905142 to your computer and use it in GitHub Desktop.
SUCCESSFUL WOMEN PROJECT - DRMII
TOP 100 SUCCESSFUL WOMEN IN THE WORLD (FORBES MAGAZINE)
How many women come from which country?
mysql> select country, count(*) from 100women group by country;
+----------------------+----------+
| country | count(*) |
+----------------------+----------+
| Argentina | 1 |
| Australia | 3 |
| Brazil | 3 |
| Burma | 1 |
| China | 7 |
| Colombia | 2 |
| France | 1 |
| Germany | 1 |
| Hong Kong | 1 |
| India | 3 |
| Indonesia | 1 |
| Italy | 2 |
| Liberia | 1 |
| Malawi | 1 |
| New Zealand | 1 |
| Nigeria | 1 |
| Saudi Arabia | 1 |
| Singapore | 2 |
| South Korea | 1 |
| Spain | 1 |
| Switzerland | 1 |
| Taiwan | 1 |
| Thailand | 1 |
| Turkey | 1 |
| United Arab Emirates | 1 |
| United Kingdom | 2 |
| United States | 58 |
+----------------------+----------+
27 rows in set (0.00 sec)
Who are the women coming from United Kingdom, what do they do and what is their position in the ranking?
mysql> select id, country, name, job, field from 100women where country = "United Kingdom";
+----+----------------+--------------------+-------------------------+---------------+
| id | country | name | job | field |
+----+----------------+--------------------+-------------------------+---------------+
| 40 | United Kingdom | Queen Elizabeth II | Monarch, United Kingdom | Government |
| 93 | United Kingdom | J.K. Rowling | Author | Entertainment |
+----+----------------+--------------------+-------------------------+---------------+
2 rows in set (0.00 sec)
How many women operate in each field?
mysql> select field, count(*) from 100women group by field;
+---------------+----------+
| field | count(*) |
+---------------+----------+
| Academia | 2 |
| Business | 29 |
| Entertainment | 10 |
| Finance | 12 |
| Government | 23 |
| Manufacturing | 10 |
| Media | 9 |
| Non Profit | 4 |
| Not Given | 1 |
+---------------+----------+
9 rows in set (0.00 sec)
How many women belong to each marital status?
mysql> select marital_status, count(*) from 100women group by marital_status;
+----------------+----------+
| marital_status | count(*) |
+----------------+----------+
| Divorced | 9 |
| Engaged | 1 |
| Married | 65 |
| Not given | 7 |
| Single | 12 |
| Widowed | 6 |
+----------------+----------+
6 rows in set (0.00 sec)
What are the average, maximum and minimum ages of the TOP100 women?
mysql> select avg(age), max(age), min(age) from 100women;
+----------+----------+----------+
| avg(age) | max(age) | min(age) |
+----------+----------+----------+
| 55.5900 | 87 | 27 |
+----------+----------+----------+
1 row in set (0.01 sec)
In average how many children do they have? (Only 67 women revealed they had children).
mysql> select avg(children) from 100women;
+---------------+
| avg(children) |
+---------------+
| 1.5500 |
+---------------+
1 row in set (0.00 sec)
Are these women mothers? How many children do they have?
mysql> select children, count(*) from 100women where children > 0 group by children;
+----------+----------+
| children | count(*) |
+----------+----------+
| 1 | 14 |
| 2 | 31 |
| 3 | 13 |
| 4 | 6 |
| 5 | 2 |
| 6 | 1 |
+----------+----------+
6 rows in set (0.00 sec)
What are the highest academic qualifications of these women?
mysql> select academic_qual, count(*) from 100women group by academic_qual;
+---------------+----------+
| academic_qual | count(*) |
+---------------+----------+
| Bachelor | 25 |
| Doctorate | 16 |
| Incomplete | 2 |
| Master | 38 |
| Not Given | 19 |
+---------------+----------+
5 rows in set (0.00 sec)
Who are the two women that didn't finish school?
mysql> select id, name, country, job, field, academic_qual from 100women where academic_qual = "Incomplete" group by id;
+----+-----------------+---------------+---------------------------------------+---------------+---------------+
| id | name | country | job | field | academic_qual |
+----+-----------------+---------------+---------------------------------------+---------------+---------------+
| 45 | Lady Gaga | United States | Musician, Philanthropist | Entertainment | Incomplete |
| 51 | Ellen DeGeneres | United States | Comedian, Personality, Philanthropist | Incomplete | Incomplete |
+----+-----------------+---------------+---------------------------------------+---------------+---------------+
2 rows in set (0.00 sec)
What are the countries in the TOP5 and in which fields do this 5 women operate in?
mysql> select id, name, country, job, field from 100women where id <=5 group by id;
+----+-----------------+---------------+------------------------------------------+------------+
| id | name | country | job | field |
+----+-----------------+---------------+------------------------------------------+------------+
| 1 | Angela Merkel | Germany | Chancellor, Germany | Government |
| 2 | Dilma Rousseff | Brazil | President, Brazil | Government |
| 3 | Melinda Gates | United States | Cochair, Bill & Melinda Gates Foundation | Business |
| 4 | Michelle Obama | United States | First Lady, United States | Government |
| 5 | Hillary Clinton | United States | Personality, Philanthropist | Government |
+----+-----------------+---------------+------------------------------------------+------------+
5 rows in set (0.00 sec)
TOP 74 PEOPLE IN THE WORLD (FORBES MAGAZINE)
Is the power mostly represented by women or men?
mysql> select gender, count(*) from 100people group by gender;
+--------+----------+
| gender | count(*) |
+--------+----------+
| Female | 9 |
| Male | 65 |
+--------+----------+
2 rows in set (0.00 sec)
Who are the women among the 74 most influencial people in the world?
mysql> select id, name, country, job, field from 100people where gender = "female" group by id;
+----+-------------------+---------------+-----------------------------------------------------------+------------+
| id | name | country | job | field |
+----+-------------------+---------------+-----------------------------------------------------------+------------+
| 5 | Angela Merkel | Germany | Chancellor, Germany | Government |
| 21 | Dilma Rousseff | Brazil | President, Brazil | Government |
| 22 | Sonia Gandhi | India | President, Indian National Congress, India | Government |
| 37 | Christine Lagarde | France | Managing Director, International Monetary Fund | Finance |
| 54 | Geun-hye Park | South Korea | President, South Korea | Government |
| 58 | Virginia Rometty | United States | CEO, IBM | Business |
| 61 | Margaret Chan | China | Director-General, World Health Organization | Government |
| 70 | Jill Abramson | United States | Executive Editor, New York Times Co. | Media |
| 74 | Janet Yellen | United States | Vice Chairman, Federal Reserve, Washington, United States | Government |
+----+-------------------+---------------+-----------------------------------------------------------+------------+
9 rows in set (0.00 sec)
In wich field do they operate in?
mysql> select field, count(*) from 100people where gender = "female" group by field;
+------------+----------+
| field | count(*) |
+------------+----------+
| Business | 1 |
| Finance | 1 |
| Government | 6 |
| Media | 1 |
+------------+----------+
4 rows in set (0.00 sec)
Where are they from?
mysql> select country, count(*) from 100people where gender = "female" group by country;
+---------------+----------+
| country | count(*) |
+---------------+----------+
| Brazil | 1 |
| China | 1 |
| France | 1 |
| Germany | 1 |
| India | 1 |
| South Korea | 1 |
| United States | 3 |
+---------------+----------+
7 rows in set (0.00 sec)
Wich are their positions in the top 100 world most powerful women?
mysql> select id, name from 100women where name = "Angela Merkel" or name = "Dilma Rousseff" or name = "Sonia Gandhi" or name = "Christine Lagarde" or name = "Geun-hye Park" or name = "Virginia Rometty" or name = "Margaret Chan" or name = "Jill Abramson" or name = "Janet Yellen" group by id;
+----+-------------------+
| id | name |
+----+-------------------+
| 1 | Angela Merkel |
| 2 | Dilma Rousseff |
| 7 | Christine Lagarde |
| 9 | Sonia Gandhi |
| 11 | Geun-hye Park |
| 12 | Virginia Rometty |
| 19 | Jill Abramson |
| 33 | Margaret Chan |
+----+-------------------+
8 rows in set (0.00 sec)
Who is in the top5 only men, women, in which field do they operate in?
mysql> select id, name, country, job, field from 100people where id <= 5 group by id;
+----+----------------+---------------+-------------------------------------------+------------+
| id | name | country | job | field |
+----+----------------+---------------+-------------------------------------------+------------+
| 1 | Vladimir Putin | Russia | President, Russia | Government |
| 2 | Barack Obama | United States | President, United States | Government |
| 3 | Xi Jinping | China | General Secretary, Communist Party, China | Government |
| 4 | Pope Francis | Argentina | Pope, Roman Catholic Church | Government |
| 5 | Angela Merkel | Germany | Chancellor, Germany | Government |
+----+----------------+---------------+-------------------------------------------+------------+
5 rows in set (0.00 sec)
Where do these 74 powerful people come from?
mysql> select country, count(*) from 100people group by country;
+----------------------+----------+
| country | count(*) |
+----------------------+----------+
| Argentina | 1 |
| Brazil | 1 |
| China | 5 |
| France | 3 |
| Germany | 2 |
| Hong Kong | 1 |
| India | 4 |
| Iran | 1 |
| Israel | 1 |
| Italy | 1 |
| Japan | 4 |
| Mexico | 3 |
| Nigeria | 1 |
| North Korea | 1 |
| Norway | 1 |
| Russia | 4 |
| Saudi Arabia | 2 |
| South Korea | 3 |
| Switzerland | 1 |
| Taiwan | 1 |
| United Arab Emirates | 1 |
| United Kingdom | 2 |
| United States | 30 |
+----------------------+----------+
23 rows in set (0.00 sec)
Are there less or more countries represented in this list comparing to the top 100 most powerful women in the world?
Top100women:
mysql> select sum(c) from (select country, count(distinct country) as c from 100women group by country) as d;
+--------+
| sum(c) |
+--------+
| 27 |
+--------+
1 row in set (0.00 sec)
Top74people:
mysql> select sum(c) from (select country, count(distinct country) as c from 100people group by country) as d;
+--------+
| sum(c) |
+--------+
| 23 |
+--------+
1 row in set (0.00 sec)
What are their average, maximum and minimum age?
mysql> select avg(age), max(age), min(age) from 100people;
+----------+----------+----------+
| avg(age) | max(age) | min(age) |
+----------+----------+----------+
| 61.3108 | 89 | 29 |
+----------+----------+----------+
1 row in set (0.00 sec)
In which industry do they operate in?
mysql> select field, count(*) from 100people group by field;
+---------------+----------+
| field | count(*) |
+---------------+----------+
| Business | 16 |
| Criminal | 1 |
| Finance | 12 |
| Government | 28 |
| Manufacturing | 13 |
| Media | 2 |
| Non Profit | 2 |
+---------------+----------+
7 rows in set (0.00 sec)
What are their higher academic qualifications?
mysql> select academic_qual, count(*) from 100people group by academic_qual;
+---------------+----------+
| academic_qual | count(*) |
+---------------+----------+
| Bachelor | 14 |
| Doctor | 6 |
| Doctorate | 6 |
| Master | 22 |
| Not given | 26 |
+---------------+----------+
5 rows in set (0.00 sec)
Which marital status do they belong to?
mysql> select marital_status, count(*) from 100people group by marital_status;
+--------------------+----------+
| marital_status | count(*) |
+--------------------+----------+
| Divorced | 3 |
| In Relationship | 2 |
| Married | 47 |
| Not Given | 14 |
| Separated | 2 |
| Single | 2 |
| Widowed | 3 |
| Widowed, Remarried | 1 |
+--------------------+----------+
8 rows in set (0.01 sec)
Are they mothers and fathers? (only 49 out of 74)
mysql> select children, count(*) from 100people where children > 0 group by children;
+----------+----------+
| children | count(*) |
+----------+----------+
| 1 | 7 |
| 2 | 16 |
| 3 | 16 |
| 4 | 6 |
| 5 | 2 |
| 6 | 2 |
+----------+----------+
6 rows in set (0.00 sec)
In average how many children do they have?
mysql> select avg(children) from 100people;
+---------------+
| avg(children) |
+---------------+
| 1.7973 |
+---------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment