We are interested here in the modeling and
treatment of the relations of affinity (related on attraction or
aversion) which can be developed inside a group of people for which the
age, the sex and the professional category are different. This classic
problem could also be treated in sociology. It will be considered,
thereafter, that the "group" is composed of 5 individuals whose
respective affinities (noted from 0 to 4) are gathered in the following
table :
Affinity
A
B
C
D
E
A
0
3
2
4
B
1
1
3
0
C
4
0
1
3
D
3
2
2
3
E
0
1
4
3
The reading, in this table, is carried out in column : the affinity of
A with respect to B is equal to 1 and that of B with respect to A is
equal to 0.
Data dictionary
Mnemonic
Wording
Affinite
Affinity (from 0 to 4) between the
individual source and the individual goal
Age
Age of the individual (in whole
years)
Categorie
Code of the professional category
of the individual
Individu
Name of the individual
Lbcategorie
Wording of the professional
category:
Worker, Employee, Supervisor, Manager, Senior manager
Lbsexe
Sex of the individual : Man or Woman
To model affinity between 2 individuals, the
attribute "Individual" will be brought to play two roles :
1- That of the individual source of the affinity : attribute "
IndividuSource "
2- That of the individual goal of the affinity : attribute "
IndividuBut "
The relations of affinity between 2 individuals not being symmetrical
it is essential here to specify the direction and the "strenght" of
relation .
Diagram of data
For a further information on the different
stages for building the diagram of data refer, in these pages, to the
column DB Design.
The attributes IndividuSource, IndividuBut
and Affinite were not classified in the preceding stage, they intervene
in a compound FD which is the following one :
The "optimal" data structure is the
following one (keys are in bold type) :
In this diagram, relations between the
table "Affinite" and the table "Individu" are not represented because
they depend on treatments, and so on various roles that the attribute
"Individu" is going to play according to questions that will be asked.
Queries
To visualize the contents of each table of
the database, type :
SELECT * FROM Name_of_the_table;
within a frame containing the button "Execute".
Note to english readers : The
value of a string attribute must be spell in french. To see the real
content of string attributes, use the command above.
Display the name, the age, the sex and the
professional category of the "Leader" of the group : the one which
collects the maximum of affinity. (Answer)
Display, for the leader, the score that he
obtained and the distribution by sex. This question can be useful, for
example, to check the "weight" of the variable Sexe in the score
obtained by the leader. (Answer)
Give the list of the "groups" of 2
individuals of the same sex, most homogeneous within the meaning of the
respective affinity of the individuals.(Answer)