Skip to content

Latest commit

 

History

History
25 lines (24 loc) · 756 Bytes

File metadata and controls

25 lines (24 loc) · 756 Bytes

Solutions - Revisit the basics

Dataset - Tennis

img

  1. In which towns do more than 5 players live, provide the name of the town and the amount of players who live there.
    SELECT 
     Town
    ,count(*) 
    FROM Players 
    GROUP BY Town 
    HAVING COUNT(*) > 5;
  2. Give the name and total penalty amount for each player that already has a total of more than or equal to 150 euro in penalties.
    SELECT 
     p.playerno
    ,SUM(pe.amount)
    FROM players p 
        JOIN penalties pe ON p.playerno = pe.playerno
    GROUP BY p.playerno
    HAVING SUM(pe.amount) >= 150;

Exercises

Click here to go back to the exercises.