Table: football_spain_stats
Columns: rank
name
season
club
goals
apps
goals_per_match

Question: How many ranks have 40 as the apps, with goals per match greater than 1?
SQL: SELECT SUM("rank") FROM football_spain_stats WHERE "apps" = 40 AND "goals_per_match" > 1

Question: What is the lowest rank that has goals per match less than 1.237, real madrid as the club, goals less than 53, with apps greater than 40?
SQL: SELECT MIN("rank") FROM football_spain_stats WHERE "goals_per_match" < 1.237 AND "club" = 'real madrid' AND "goals" < 53 AND "apps" > 40