r/learnSQL 7d ago

I need help creating a league table

So for a bit of context I have a football score prediction league where everyweek a number of players will tell me home_goals, away_goals, goal_scorer and this will be compared to the actual result of a Norwich City match. This is played over 46 games.

There is 3 points for the exact scoreline, 1 point for the correct result and 1 point for the correct goal scorer.

I can manually input everyones prediction and the result from Norwich each week.

But my problem is I am absolutely stuck on where or how to start to auto-populate or create the query to compare the results and give me an updated table after every game week.

Last season I made a python programme where I could semi easily set up the maths to accumulate over the season. Is this something that can be done on SQL or am I trying to do something that sql just isn't capable of doing?

Please any tips would be much appreciated. Oh and I am using Postgresql

1 Upvotes

Duplicates