Designing tournament/matches database

477 Views Asked by At

I'm trying to design simple data base that will present some kind of tournament. So I have table that present 'Matches' (it contains two team's ID's), I've also created table 'Round' (one round contains few matches). And there's my question. I want to create 'something' (table/view/procedure/function) that will make possible for me to show ranking of my tournament after given (via argument or using 'where' in select instruction) id of round. For example, there are two teams, team A and team B. In first and second round team A won. So after i pass via something number '1' I want to get output:

Position | Team   | Points
:-----   | -----: | :----:
1        | Team A | 3
:-----   | -----: | :----:
2        | Team B | 0

What is the easiest way to achieve something like that ?

1

There are 1 best solutions below

4
On

I'm not fully sure I understand what the parameter you are passing in represents, but it sounds like you want to make a stored procedure. And yes you are correct you could use the parameter that is passed in, in your where clause.