Categories - non-sono-bello-ma-patcho/BD_LAB GitHub Wiki

For each category, the database will keep track of the name of the category, its regulation and the minimum/maximum number of player allowed. This is how we design the category entity in the ER scheme:

categoriesER

As you can see Categories entity's design is quite simple, it has no external references, multi-value attributes or peculiar constraint.

At the beginning, the name column had type varchar, anyway it turned out that the Categories table only keep track of the sports managed by the platform and so it content is static, since users are not allowed to add categories to it. We preferred then to create the new datatype sport to not use external references and speed up value validation. In this terms the table is more of a wrapper for each single sports:

create type sport as enum('calcio', 'basket', 'tennis', 'volley');
create table Categories (
  name sport primary key,
  regulation text,
  max int,
  min int
);