There are 3 tables:
scoreT
-----------------------
id_score | id_name | score
1 | 1 | 350
2 | 2 | 400
3 | 3 | 450
4 | 4 | 330
5 | 5 | 500
nameT
------------------------
id_name | name | id_country
1 | Bill | 1
2 | Ana | 2
3 | Ted | 2
4 | Ryan | 3
5 | Kyle | 3
countryT
id_country | country
1 | USA
2 | INA
3 | GER
So how to make query table like this?
country | count of name | average of Score | count name who have Score >= 400 | percentage of name who have Score >= 400 |
USA | 1 | 350 | 0 | 0
INA | 2 | 425 | 2 | 100
GER | 2 | 415 | 1 | 50
scoreT
-----------------------
id_score | id_name | score
1 | 1 | 350
2 | 2 | 400
3 | 3 | 450
4 | 4 | 330
5 | 5 | 500
nameT
------------------------
id_name | name | id_country
1 | Bill | 1
2 | Ana | 2
3 | Ted | 2
4 | Ryan | 3
5 | Kyle | 3
countryT
id_country | country
1 | USA
2 | INA
3 | GER
So how to make query table like this?
country | count of name | average of Score | count name who have Score >= 400 | percentage of name who have Score >= 400 |
USA | 1 | 350 | 0 | 0
INA | 2 | 425 | 2 | 100
GER | 2 | 415 | 1 | 50
Comment