-2

In volleyball you usually have the best of five rule. That means there are max 5 sets than can be played. The first ones until 25 and the last one until 15. The score might looks like this:

25:23 - 23:25 - 25:16 - 11:25 - 15:10 => Team A wins against Team B 3:2
25:10 - 25:21 - 25:13                 => Team A wins against Team B 3:0

For training or in school you might also want to play best of three, e.g.

25:13 - 11:25 - 15:10 => Team A wins against Team B 2:1
25:13 - 25:10         => Team A wins against Team B 2:0

You could also say that the set lengths aren't until 25 but 15, e.g.

15:13 - 11:15 - 15:10 => Team A wins against Team B 2:1
15:13 - 15:10         => Team A wins against Team B 2:0

So when you start a match you choose the number of max. sets (5 or 3) and the set length (25 or 15).

How would you store this in a normalized database? At the moment my schema looks like this.

id | name        | set_lengths
----------------------------------------
 1 | men bronze  | [25, 25, 25, 25, 15]
 2 | woman final | [15, 15, 15]

In the last weeks I read a lot about normalization and as far as I understand using arrays is not really normalized. Any ideas how I could achieve this without using arrays?

philipxy
  • 14,867
  • 6
  • 39
  • 83
zemirco
  • 16,171
  • 8
  • 62
  • 96
  • 1
    What if team wins by 27-25 or 28-26? – saravanatn Apr 19 '18 at 08:08
  • My first impulse would be to create 2 other tables: match_set (containing the match identifier, score, and set_type) and set_type (containing only set types, e.g. normal set, tie break) – Jim Jones Apr 19 '18 at 08:09
  • 1
    Hi. What is your reference for "normalize"? And for information modeling & relational database--because this is an absolutely basic question. Please read & act on 'stackexchange homework'. (It doesn't matter whether this *is* homework.) Show your work following it. What does it say to do? Where are you stuck? Otherwise you are just asking us to rewrite a textbook. Please read [ask] & the downvote arrow mouseover text. PS ["normalization to 1NF" has no single meaning.](https://stackoverflow.com/a/40640962/3404097) – philipxy Apr 20 '18 at 21:28

2 Answers2

0

A simple solution could be based on two table
match and set

where in match table you a match name a match type ( 3 or 5 sets) and team name for team1 and team2

match  
id, name, match_type,  team1, team2 

set 

id, id_match , set_id, point_team1, point_team_2 

or you can also add team table

 team
 id, name  

and in this case in

match  
id, name, match_type,  id_team1, id_team2 
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
0

A table for controlling set types:

Set_Type: set_type_id, description, min_points
ex: 1, 'Tie Break', 15

A table for the matches itself:

Match: match_id, name, team1, team2
ex: 10, 'Final Men', team1, team2

And another one as intermediate table for the sets

Match_Set: match_id, set_type_id, score_team1, score_team2, nr
ex: 10, 1, 10, 15, 5
Jim Jones
  • 18,404
  • 3
  • 35
  • 44