I have the following table schema:
Person:
Name | Year | Sports
Hans | 23 | Football
Hans | 23 | Baseball
Hans | 23 | Badminton
Albert | 25 | Baseball
Albert | 25 | Badminton
Sports:
Name | Tempo | Amount
Football | Fast | 5
Baseball | Slow | 3
Badminton | Fast | 4
Speed:
Name | Star
Fast | Good
Slow | Bad
The question I am trying to solve is: Which Sports are used by every person and also has the star value good?
The result I want:
Albert | 25 | Badminton
My question would be: How can I realize this with a select statement? My current solution is:
SELECT * FROM speed JOIN
(SELECT * FROM person JOIN sports USING (name)) USING (name) WHERE STAR = 'good'
I don't know how to filter this more.
Alternative Tables
Country:
Name | Capital
USA | Washington
Germany | Berlin
France | Paris
Poland | Warsaw
Sports
Country | Sport
Germany | Football
Belgium | Baseball
Belgium | Football
France | Football
Poland | Baseball
Poland | Football
Region
Country | Area
Germany | Europe
Belgium | Europe
France | Europe
Poland | Europe
New Question: Which sport is played by every European country?
Output: Football, because it is played by germany, france, belgium and poland